Skip to content

Commit

Permalink
updated data_import.jl
Browse files Browse the repository at this point in the history
- added conversion to km when creating the GeoData object
- added test
  • Loading branch information
mthielma committed Feb 29, 2024
1 parent 515d2c4 commit c562f0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/data_import.jl
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,6 @@ function GetLonLatDepthMag_QuakeML(filename::String)
mag[ievent] = parse(Float64,string(collect(child_nodes(get_elements_by_tagname(get_elements_by_tagname(magnitude[1],"mag")[1],"value")[1]))[1]));
end

Data_ISC = GeoData(lon,lat,depth,(Magnitude=mag,Depth=depth));
Data_ISC = GeoData(lon,lat,-1*depth/1e3,(Magnitude=mag,Depth=-1*depth/1e3*km));
return Data_ISC
end
7 changes: 7 additions & 0 deletions test/test_data_import.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,10 @@ data_Image = Screenshot_To_UTMData(filename,Corner_LowerLeft, Corner_
@test data_Image.EW.val[22] 0.42424242424242425
@test data_Image.NS.val[22] 48.666666666666664
@test Value(data_Image.depth[22]) -15.0m

# test the import of xml files from ISC
# the search criteria are set in a way that only one event should be found
download_data("http://www.isc.ac.uk/cgi-bin/web-db-run?request=COLLECTED&req_agcy=ISC-EHB&out_format=QuakeML&ctr_lat=&ctr_lon=&radius=&max_dist_units=deg&searchshape=RECT&top_lat=49&bot_lat=37&left_lon=4&right_lon=20&srn=&grn=&start_year=2000&start_month=1&start_day=01&start_time=00%3A00%3A00&end_year=2005&end_month=12&end_day=31&end_time=00%3A00%3A00&min_dep=&max_dep=&min_mag=5.8&max_mag=&req_mag_type=Any&req_mag_agcy=Any&min_def=&max_def=&include_magnitudes=on&include_links=on&include_headers=on&include_comments=on&table_owner=iscehb","ISCTest.xml")
Data_ISC = GetLonLatDepthMag_QuakeML("ISCTest.xml");
@test Value(Data_ISC.depth[1])==-13.0km
@test Data_ISC.fields.Magnitude[1]==5.8

0 comments on commit c562f0e

Please sign in to comment.