22# this is ProfileProcessing.jl
33# It contains functions and type definitions to gather selected data for given profiles
44
5- export ProfileData, extractProfileData, createProfileData , GMG_Dataset, load_Dataset_file, combine_VolData
6- export extractProfileData !, readPickedProfiles
5+ export ProfileData, extract_ProfileData, create_ProfileData , GMG_Dataset, load_dataset_file, combine_vol_data
6+ export extract_ProfileData !, read_picked_profiles
77import Base: show
88
99"""
133133
134134"""
135135
136- Datasets = load_Dataset_file (file_datasets::String)
136+ Datasets = load_dataset_file (file_datasets::String)
137137
138138This loads a CSV textfile that lists datasets, which is expected to have the following format:
139139
@@ -149,7 +149,7 @@ Here, the meaning of the variables is:
149149- `Active`: Do we want this file to be loaded or not? Optional parameter that defaults to `true`
150150
151151"""
152- function load_Dataset_file (file_datasets:: String )
152+ function load_dataset_file (file_datasets:: String )
153153 datasets = readdlm (file_datasets,' ,' ,skipstart = 1 ); # read information on datasets to be used from text file
154154 n = size (datasets,1 )
155155
@@ -209,13 +209,13 @@ end
209209
210210"""
211211
212- VolData_combined = combine_VolData (VolData::NamedTuple; lat=nothing, lon=nothing, depth=nothing, dims=(100,100,100), dataset_preferred = 1)
212+ VolData_combined = combine_vol_data (VolData::NamedTuple; lat=nothing, lon=nothing, depth=nothing, dims=(100,100,100), dataset_preferred = 1)
213213
214214This takes different volumetric datasets (specified in `VolData`) & merges them into a single one.
215215You need to either provide the "reference" dataset within the NamedTuple (`dataset_preferred`), or the lat/lon/depth and dimensions of the new dataset.
216216
217217"""
218- function combine_VolData (VolData:: NamedTuple ; lat= nothing , lon= nothing , depth= nothing , dims= (100 ,100 ,100 ), dataset_preferred = 1 )
218+ function combine_vol_data (VolData:: NamedTuple ; lat= nothing , lon= nothing , depth= nothing , dims= (100 ,100 ,100 ), dataset_preferred = 1 )
219219
220220 # Get dimensions of new Data_set
221221 i = dataset_preferred
@@ -349,11 +349,11 @@ end
349349
350350
351351"""
352- extractProfileData !(Profile::ProfileData,VolData::GeoData, SurfData::NamedTuple, PointData::NamedTuple; DimsVolCross=(100,100),Depth_extent=nothing,DimsSurfCross=(100,),section_width=50)
352+ extract_ProfileData !(Profile::ProfileData,VolData::GeoData, SurfData::NamedTuple, PointData::NamedTuple; DimsVolCross=(100,100),Depth_extent=nothing,DimsSurfCross=(100,),section_width=50)
353353
354354Extracts data along a vertical or horizontal profile
355355"""
356- function extractProfileData ! (Profile:: ProfileData ,VolData:: Union{Nothing,GeoData} = nothing , SurfData:: NamedTuple = NamedTuple (), PointData:: NamedTuple = NamedTuple (); DimsVolCross= (100 ,100 ),Depth_extent= nothing ,DimsSurfCross= (100 ,),section_width= 50 km)
356+ function extract_ProfileData ! (Profile:: ProfileData ,VolData:: Union{Nothing,GeoData} = nothing , SurfData:: NamedTuple = NamedTuple (), PointData:: NamedTuple = NamedTuple (); DimsVolCross= (100 ,100 ),Depth_extent= nothing ,DimsSurfCross= (100 ,),section_width= 50 km)
357357
358358 if ! isnothing (VolData)
359359 CreateProfileVolume! (Profile, VolData; DimsVolCross= DimsVolCross, Depth_extent= Depth_extent)
367367"""
368368This reads the picked profiles from disk and returns a vector of ProfileData
369369"""
370- function readPickedProfiles (ProfileCoordFile:: String )
370+ function read_picked_profiles (ProfileCoordFile:: String )
371371
372372 profiles = Vector {ProfileData} ()
373373 profile_data = readdlm (ProfileCoordFile,skipstart= 1 ,' ,' )
@@ -384,14 +384,14 @@ end
384384
385385# this is mostly for backwards compatibility
386386"""
387- extractProfileData (ProfileCoordFile::String,ProfileNumber::Int64,DataSetFile::String; DimsVolCross=(100,100),DepthVol=nothing,DimsSurfCross=(100,),WidthPointProfile=50km)
387+ extract_ProfileData (ProfileCoordFile::String,ProfileNumber::Int64,DataSetFile::String; DimsVolCross=(100,100),DepthVol=nothing,DimsSurfCross=(100,),WidthPointProfile=50km)
388388
389389This is a convenience function (mostly for backwards compatibility with the MATLAB GUI) that loads the data from file & projects it onto a profile
390390"""
391- function extractProfileData (ProfileCoordFile:: String ,ProfileNumber:: Int64 ,DataSetFile:: String ; DimsVolCross= (100 ,100 ),DepthVol= nothing ,DimsSurfCross= (100 ,),WidthPointProfile= 50 km)
391+ function extract_ProfileData (ProfileCoordFile:: String ,ProfileNumber:: Int64 ,DataSetFile:: String ; DimsVolCross= (100 ,100 ),DepthVol= nothing ,DimsSurfCross= (100 ,),WidthPointProfile= 50 km)
392392
393393 # read profile
394- profile_list = readPickedProfiles (ProfileCoordFile)
394+ profile_list = read_picked_profiles (ProfileCoordFile)
395395 profile = profile_list[ProfileNumber]
396396
397397 println (" lon start " , profile. start_lonlat[1 ])
@@ -400,16 +400,16 @@ function extractProfileData(ProfileCoordFile::String,ProfileNumber::Int64,DataSe
400400 println (" lat end " , profile. end_lonlat[2 ])
401401
402402 # read all datasets:
403- Datasets_all = load_Dataset_file (DataSetFile)
403+ Datasets_all = load_dataset_file (DataSetFile)
404404
405405 # load all Data
406406 VolData, SurfData, PointData, ScreenshotData, TopoData = load_GMG (Datasets_all)
407407
408408 # merge VolData:
409- VolData_combined = combine_VolData (VolData)
409+ VolData_combined = combine_vol_data (VolData)
410410
411411 # project data onto profile:
412- extractProfileData ! (profile, VolData_combined, SurfData, PointData,
412+ extract_ProfileData ! (profile, VolData_combined, SurfData, PointData,
413413 DimsVolCross= DimsVolCross, DimsSurfCross= DimsSurfCross,
414414 Depth_extent= DepthVol, section_width= WidthPointProfile)
415415
421421
422422# Boris: I don't know exactly in which format you have your current files;
423423### wrapper function to extract data for a single profile
424- function extractProfileData (ProfileCoordFile,ProfileNumber,DataSetName,DataSetFile,DataSetType,DimsVolCross,DepthVol,DimsSurfCross,WidthPointProfile)
424+ function extract_ProfileData (ProfileCoordFile,ProfileNumber,DataSetName,DataSetFile,DataSetType,DimsVolCross,DepthVol,DimsSurfCross,WidthPointProfile)
425425
426426 # start and end points are saved in a text file
427427 profile_data = readdlm(ProfileCoordFile,skipstart=1,',')
463463### currently, the function is quite slow, as the different data sets are reloaded for each profile.
464464### a faster way would be to load one data set and create the profiles from it and then move on to the next one. However, this would require to hold all the profile data in memory, which may be a bit much...
465465
466- function createProfileData (file_profiles,file_datasets;Depth_extent=(-300,0),DimsVolCross=(500,300),DimsSurfCross = (100,),WidthPointProfile = 20km)
466+ function create_ProfileData (file_profiles,file_datasets;Depth_extent=(-300,0),DimsVolCross=(500,300),DimsSurfCross = (100,),WidthPointProfile = 20km)
467467 # get the number of profiles
468468 profile_data = readdlm(file_profiles,skipstart=1,',')
469469 NUM = convert.(Int,profile_data[:,1]);
@@ -480,7 +480,7 @@ function createProfileData(file_profiles,file_datasets;Depth_extent=(-300,0),Dim
480480 for iprofile = 1:length(ProfileNumber)
481481
482482 # 2. process the profiles
483- ExtractedData = extractProfileData (file_profiles,ProfileNumber[iprofile],DataSetName,DataSetFile,DataSetType,DimsVolCross,Depth_extent,DimsSurfCross,WidthPointProfile)
483+ ExtractedData = extract_ProfileData (file_profiles,ProfileNumber[iprofile],DataSetName,DataSetFile,DataSetType,DimsVolCross,Depth_extent,DimsSurfCross,WidthPointProfile)
484484
485485 # 3. save data as JLD2
486486 fn = "Profile"*string(ProfileNumber[iprofile])
0 commit comments