Data may be taken along discrete paths through space, each path constituting a connected set of points called a trajectory, for example along a flight path, a ship path or the path of a parcel in a Lagrangian calculation. A data variable may contain a collection of trajectory features. The instance dimension in the case of trajectories specifies the number of trajectories in the collection and is also referred to as the trajectory dimension. The instance variables, which have just this dimension, are also referred to as trajectory variables and are considered to be information about the trajectories. It is strongly recommended that there always be a trajectory variable (of any data type) with the attribute cf_role=”trajectory_id”
attribute, whose values uniquely identify the trajectories. The trajectory variables may contain missing values. This allows one to reserve space for additional trajectories that may be added at a later time, as discussed in section 9.6. All the representations described in section 9.3 can be used for trajectories. The global attribute featureType=”trajectory”
(case-insensitive) should be included if all data variables in the file contain trajectories.
When storing multiple trajectories in the same file, and the number of elements in each trajectory is the same, one can use the multidimensional array representation. This representation also allows one to have a variable number of elements in different trajectories, at the cost of some wasted space. In that case, any unused elements of the data and auxiliary coordinate variables must contain missing data values (section 9.6).
Example H.12. Trajectories recording atmospheric composition in the incomplete multidimensional array representation.
dimensions: obs = 1000 ; trajectory = 77 ; variables: char trajectory(trajectory, name_strlen) ; trajectory:cf_role = "trajectory_id"; trajectory:long_name = "trajectory name" ; int trajectory_info(trajectory) ; trajectory_info:long_name = "some kind of trajectory info" double time(trajectory, obs) ; time:standard_name = "time"; time:long_name = "time" ; time:units = "days since 1970-01-01 00:00:00" ; float lon(trajectory, obs) ; lon:standard_name = "longitude"; lon:long_name = "longitude" ; lon:units = "degrees_east" ; float lat(trajectory, obs) ; lat:standard_name = "latitude"; lat:long_name = "latitude" ; lat:units = "degrees_north" ; float z(trajectory, obs) ; z:standard_name = “altitude”; z:long_name = "height above mean sea level" ; z:units = "km" ; z:positive = "up" ; z:axis = "Z" ; float O3(trajectory, obs) ; O3:standard_name = “mass_fraction_of_ozone_in_air”; O3:long_name = "ozone concentration" ; O3:units = "1e-9" ; O3:coordinates = "time lon lat z" ; float NO3(trajectory, obs) ; NO3:standard_name = “mass_fraction_of_nitrate_radical_in_air”; NO3:long_name = "NO3 concentration" ; NO3:units = "1e-9" ; NO3:coordinates = "time lon lat z" ; attributes: :featureType = "trajectory";
The NO3(i,o) and O3(i,o) data for element o of trajectory i are associated with the coordinate values time(i,o), lat(i,o), lon(i,o), and z(i,o). Either the instance (trajectory) or the element (obs) dimension could be the netCDF unlimited dimension. All variables that have trajectory as their only dimension are considered to be information about that trajectory.
If the trajectories all have the same set of times, the time auxiliary coordinate variable could be one-dimensional time(obs), or replaced by a one-dimensional coordinate variable time(time), where the size of the time dimension is now equal to the number of elements of each trajectory. In the latter case, listing the time coordinate variable in the coordinates attribute is optional.
When a single trajectory is stored in the data variable, there is no need for the trajectory dimension and the arrays are one-dimensional. This is a special case of the multidimensional array representation.
Example H.13. A single trajectory recording atmospheric composition.
dimensions: time = 42; variables: char trajectory(name_strlen) ; trajectory:cf_role = "trajectory_id"; double time(time) ; time:standard_name = "time"; time:long_name = "time" ; time:units = "days since 1970-01-01 00:00:00" ; float lon(time) ; lon:standard_name = "longitude"; lon:long_name = "longitude" ; lon:units = "degrees_east" ; float lat(time) ; lat:standard_name = "latitude"; lat:long_name = "latitude" ; lat:units = "degrees_north" ; float z(time) ; z:standard_name = “altitude”; z:long_name = "height above mean sea level" ; z:units = "km" ; z:positive = "up" ; z:axis = "Z" ; float O3(time) ; O3:standard_name = “mass_fraction_of_ozone_in_air”; O3:long_name = "ozone concentration" ; O3:units = "1e-9" ; O3:coordinates = "time lon lat z" ; float NO3(time) ; NO3:standard_name = “mass_fraction_of_nitrate_radical_in_air”; NO3:long_name = "NO3 concentration" ; NO3:units = "1e-9" ; NO3:coordinates = "time lon lat z" ; attributes: :featureType = "trajectory";
The NO3(o) and O3(o) data are associated with the coordinate values time(o), z(o), lat(o), and lon(o). In this example, the time coordinate is ordered, so time values are contained in a coordinate variable i.e. time(time) and time is the element dimension. The time dimension may be unlimited or not.
Note that structurally this looks like unconnected point data as in example 9.5. The presence of the featureType = "trajectory" global attribute indicates that in fact the points are connected along a trajectory.
When the number of elements for each trajectory varies, and one can control the order of writing, one can use the contiguous ragged array representation. The canonical use case for this is when rewriting raw data, and you expect that the common read pattern will be to read all the data from each trajectory.
Example H.14. Trajectories recording atmospheric composition in the contiguous ragged array representation.
dimensions: obs = 3443; trajectory = 77 ; variables: char trajectory(trajectory, name_strlen) ; trajectory:cf_role = "trajectory_id"; int rowSize(trajectory) ; rowSize:long_name = "number of obs for this trajectory " ; rowSize:sample_dimension = "obs" ; double time(obs) ; time:standard_name = "time"; time:long_name = "time" ; time:units = "days since 1970-01-01 00:00:00" ; float lon(obs) ; lon:standard_name = "longitude"; lon:long_name = "longitude" ; lon:units = "degrees_east" ; float lat(obs) ; lat:standard_name = "latitude"; lat:long_name = "latitude" ; lat:units = "degrees_north" ; float z(obs) ; z:standard_name = “altitude”; z:long_name = "height above mean sea level" ; z:units = "km" ; z:positive = "up" ; z:axis = "Z" ; float O3(obs) ; O3:standard_name = “mass_fraction_of_ozone_in_air”; O3:long_name = "ozone concentration" ; O3:units = "1e-9" ; O3:coordinates = "time lon lat z" ; float NO3(obs) ; NO3:standard_name = “mass_fraction_of_nitrate_radical_in_air”; NO3:long_name = "NO3 concentration" ; NO3:units = "1e-9" ; NO3:coordinates = "time lon lat z" ; attributes: :featureType = "trajectory";
The O3(o) and NO3(o) data are associated with the coordinate values time(o), lat(o), lon(o), and alt(o). All elements for one trajectory are contiguous along the sample dimension. The sample dimension (obs) may be the unlimited dimension or not. All variables that have the instance dimension (trajectory) as their single dimension are considered to be information about that trajectory.
The count variable (row_size) contains the number of elements for each trajectory, and is identified by having an attribute with name "sample_dimension" whose value is the sample dimension being counted. It must have the trajectory dimension as its single dimension, and must be type integer. The elements are associated with the trajectories using the same algorithm as in H.2.4.
When the number of elements at each trajectory vary, and the elements cannot be written in order, one can use the indexed ragged array representation. The canonical use case is when writing real-time data streams that contain reports from many trajectories. The data can be written as it arrives; if the flatsample dimension is the unlimited dimension, this allows data to be appended to the file.
Example H.15. Trajectories recording atmospheric composition in the indexed ragged array representation.
dimensions: obs = UNLIMITED ; trajectory = 77 ; variables: char trajectory(trajectory, name_strlen) ; trajectory:cf_role = "trajectory_id"; int trajectory_index(obs) ; trajectory_index:long_name = "index of trajectory this obs belongs to " ; trajectory_index:instance_dimension= "trajectory" ; double time(obs) ; time:standard_name = "time"; time:long_name = "time" ; time:units = "days since 1970-01-01 00:00:00" ; float lon(obs) ; lon:standard_name = "longitude"; lon:long_name = "longitude" ; lon:units = "degrees_east" ; float lat(obs) ; lat:standard_name = "latitude"; lat:long_name = "latitude" ; lat:units = "degrees_north" ; float z(obs) ; z:standard_name = “altitude”; z:long_name = "height above mean sea level" ; z:units = "km" ; z:positive = "up" ; z:axis = "Z" ; float O3(obs) ; O3:standard_name = “mass_fraction_of_ozone_in_air”; O3:long_name = "ozone concentration" ; O3:units = "1e-9" ; O3:coordinates = "time lon lat z" ; float NO3(obs) ; NO3:standard_name = “mass_fraction_of_nitrate_radical_in_air”; NO3:long_name = "NO3 concentration" ; NO3:units = "1e-9" ; NO3:coordinates = "time lon lat z" ; attributes: :featureType = "trajectory";
The O3(o) and NO3(o) data are associated with the coordinate values time(o), lat(o), lon(o), and alt(o). All elements for one trajectory will have the same trajectory index value. The sample dimension (obs) may be the unlimited dimension or not.
The index variable (trajectory_index) is identified by having an attribute with name of "instance_dimension" whose value is the trajectory dimension name. It must have the sample dimension as its single dimension, and must be type integer. Each value in the trajectory_index variable is the zero-based trajectory index that the element belongs to. The elements are associated with the trajectories using the same algorithm as in H.2.5.