@@ -316,33 +316,39 @@ function create_profile_point!(Profile::ProfileData, DataSet::NamedTuple; sectio
316316 tmp = NamedTuple () # initialize empty one
317317 DataSetName = keys (DataSet) # Names of the datasets
318318 for idata = 1 : num_datasets
319-
320319 # 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
321320 data_tmp = DataSet[idata]
322321
323322 if Profile. vertical
324323 # take a vertical cross section
325324 data = cross_section_points (data_tmp, Start= Profile. start_lonlat, End= Profile. end_lonlat, section_width = section_width) # create the cross section
326325
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
335338 else
336339 # take a horizontal cross section
337340 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
342349 end
343350 end
344351
345- Profile. PointData = tmp # assign to profile data structure
346352 return
347353end
348354
0 commit comments