This component provides utilities to select specific components out of the whole data stream. This includes including or excluding specific variables only and selecting paths from within complex types.
Usage
da.select [switches…] [[station] variables times [archive]|[file]]
Switches
- --capture-archive=STRINGS
-
This is a regular expression the archive must match to be changed. When set the captures ${1}, ${2}, … are available for substitution in the output archive.
- --capture-station=STRINGS
-
This is a regular expression the station must match to be changed. When set the captures ${1}, ${2}, … are available for substitution in the output station.
- --capture-variable=STRINGS
-
This is a regular expression the variable must match to be changed. When set the captures ${1}, ${2}, … are available for substitution in the output variable.
- --end=TIME
-
This is the end time to output data. If this is set then no data after this time is output.
- --exclude=SELECTION
-
This option sets the values that are excluded from the output.
Default: Nothing
- --explicit-meta[=BOOLEANS]
-
When enabled this changes the handling of metadata so it must be matched manually. Normally metadata is unchanged by path access and is passed if the corresponding normal value passes.
- --include=SELECTION
-
This option sets the values that are included in the output.
Default: Everything
- --path=STRINGS
-
This is the path applied to values. This only makes sense for values with child types (e.x. hashes or metadata). The value accessed at the path will become the new root for everything it is applied to.
Default: None
- --path-apply=SELECTION
-
This option sets the values that have the path applied to them in the output.
Default: Everything
- --path-remove[=BOOLEANS]
-
When enabled this changes the path to be removed from the value instead of applying it and passing the value. This is, this causes the path within values to be deleted.
- --remove-undefined[=BOOLEANS]
-
When enabled this this removes all undefined values from the output.
- --set-apply=SELECTION
-
This option sets the values that have the alteration of station, archive and/or variable applied to them.
Default: Everything
- --set-archive=STRINGS
-
This is the archive that values are set to.
Default: No change
- --set-duplicate[=BOOLEANS]
-
When enabled this causes a copy of the value to be generated before the station, archive, or variable are changed.
- --set-flavor-add=STRINGS
-
This is a flavor that is added.
Default: No change
- --set-flavor-remove=STRINGS
-
This is a flavor that is removed.
Default: No change
- --set-station=STRINGS
-
This is the station that values are set to.
Default: No change
- --set-variable=STRINGS
-
This is the variable that values are set to.
Default: No change
- --start=TIME
-
This is the start time to output data. If this is set then no data before this time is output.
Arguments
If no bare word input specification is supplied then data are read from standard input.
- station
-
This argument is used to specify the station used to look up variables that do not include a station as part of an archive read specification. The station is the three letter GAW station code of the location, such as
BND
. The argument accepts multiple stations specified as regular expressions and separated by:
or;
or,
. For exampleBND,MLO
and(BND|MLO)
are two ways of selecting both the BND and MLO stations.The special value
allstations
may also be specified to select all stations. - variables
-
This argument may be split into multiple actual program arguments. Each part consists of one or more variable specifications separated by
,
(commas). The station and archive used if none are explicitly given are defined in the other arguments or inferred from system defaults. For example simplyBsB_S11
selects the blue scattering from the S11 instrument and returns all cut sizes and metadata. If instead::BsB_S11:pm10
is used then only PM10 scattering is returned. That is, the selection specifies "any" station and archive (the defaults are set in the other arguments) then requires that it has the "PM10" flavor. A specification such asbnd:BsB_S11,thd:BsB_S11
allows for data selection from multiple stations.This may also be used to select a "record" type alias such as "S11a". In this mode all the variables defined in the alias are returned.
Finally the special value
everything
can be used to select all available data for the given station(s) and archive(s). - times
-
This argument may be split into multiple actual program arguments. This full list of time arguments defines a time bounds list that sets the range of data queried. The final resulting data are clipped to the given time bounds but any values that intersect them are returned.
- archive
-
This argument is used to specify the archive used to look up variables that do not include an archive as part of an archive read specification. The archive is the internal name, such as
raw
orclean_meta
. The argument accepts multiple archives specified as regular expressions and separated by:
or;
or,
. For exampleraw(_meta)?
selects both theraw
andraw_meta
archives.The special value
allarchives
may also be used to select all available archives. - file
-
This argument is used to specify the the file to read data from. If it is present and exists then data is read from the given file name instead of from standard input. Alternatively
-
(a single dash) may be used to explicitly specify standard input.
Examples
- Select variable
-
This creates output that only contains a single variable.
da.select --include=bnd:raw:BsG_S11 bnd S11a 2015-05-01 2015-05-03
Or:
da.select --include=bnd:raw:BsG_S11 input_file.c3d
Or:
da.get bnd S11a 2015-05-01 2015-05-03 | da.select --include=bnd:raw:BsG_S11
- Extract wavelength
-
This creates output that contains only the wavelength information from a single variable.
da.select --explicit-meta --include=bnd:raw_meta:BsG_S11 --path=^Wavelength --remove-undefined --set-archive=raw bnd S11a 2015-05-01 2015-05-03