@@ -316,33 +316,39 @@ function create_profile_point!(Profile::ProfileData, DataSet::NamedTuple; sectio
316
316
tmp = NamedTuple () # initialize empty one
317
317
DataSetName = keys (DataSet) # Names of the datasets
318
318
for idata = 1 : num_datasets
319
-
320
319
# load data set --> each data set is a single GeoData structure, so we'll only have to get the respective key to load the correct type
321
320
data_tmp = DataSet[idata]
322
321
323
322
if Profile. vertical
324
323
# take a vertical cross section
325
324
data = cross_section_points (data_tmp, Start= Profile. start_lonlat, End= Profile. end_lonlat, section_width = section_width) # create the cross section
326
325
327
- # flatten cross section and add this data to the structure
328
- x_profile = flatten_cross_section (data,Start= Profile. start_lonlat)
329
- data = addfield (data," x_profile" ,x_profile)
330
-
331
- # add the data set as a NamedTuple
332
- data_NT = NamedTuple {(DataSetName[idata],)} ((data,))
333
- tmp = merge (tmp,data_NT)
334
-
326
+ if isnothing (data)
327
+ # do nothing, as there is no data
328
+ else
329
+ # flatten cross section and add this data to the structure
330
+ x_profile = flatten_cross_section (data,Start= Profile. start_lonlat)
331
+ data = addfield (data," x_profile" ,x_profile)
332
+
333
+ # add the data set as a NamedTuple
334
+ data_NT = NamedTuple {(DataSetName[idata],)} ((data,))
335
+ tmp = merge (tmp,data_NT)
336
+ Profile. PointData = tmp # assign to profile data structure
337
+ end
335
338
else
336
339
# take a horizontal cross section
337
340
data = cross_section (data_tmp, Depth_level= Profile. depth, section_width = section_width) # create the cross section
338
-
339
- # add the data set as a NamedTuple
340
- data_NT = NamedTuple {(DataSetName[idata],)} ((data,))
341
- tmp = merge (tmp,data_NT)
341
+ if isnothing (data)
342
+ # do nothing, as there is no data
343
+ else
344
+ # add the data set as a NamedTuple
345
+ data_NT = NamedTuple {(DataSetName[idata],)} ((data,))
346
+ tmp = merge (tmp,data_NT)
347
+ Profile. PointData = tmp # assign to profile data structure
348
+ end
342
349
end
343
350
end
344
351
345
- Profile. PointData = tmp # assign to profile data structure
346
352
return
347
353
end
348
354
0 commit comments