Skip to content

Commit e0ceef6

Browse files
committed
Document new numericTimeSettings NcML scan attribute
1 parent 466ff2d commit e0ceef6

File tree

3 files changed

+49
-42
lines changed

3 files changed

+49
-42
lines changed

docs/src/site/pages/netcdfJava/NcmlCookbook.md

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ See [Dataset URLs](dataset_urls.html) for more information on the location attri
190190

191191
### Assign coordinate values to unknown number of datasets.
192192

193-
You dont have to know the number of files found in the scan, but they must be evenly spaced, and they must be in alphabetic order.
193+
You don't have to know the number of files found in the scan, but they must be evenly spaced, and they must be in alphabetic order.
194194

195195
~~~xml
196196
<?xml version="1.0" encoding="UTF-8"?>
@@ -207,7 +207,7 @@ You dont have to know the number of files found in the scan, but they must be ev
207207
</netcdf>
208208
~~~
209209

210-
### Scan directory, assign date coordinate value from filename.
210+
### Scan directory, assign date coordinate value (ISO time strings) from filename.
211211

212212
The date coordinate must be derivable from the filename, using the dateFormatMark attribute.
213213

@@ -221,6 +221,23 @@ The date coordinate must be derivable from the filename, using the dateFormatMar
221221
</netcdf>
222222
~~~
223223

224+
### Scan directory, assign date coordinate value (numeric, UDUNITS compatible) from filename.
225+
226+
The date coordinate must be derivable from the filename, using the dateFormatMark attribute.
227+
The numericTimeSettings consists of a data type plus a UDUNITS time unit.
228+
These should be chosen carefully, as truncation can occur.
229+
230+
~~~xml
231+
<?xml version="1.0" encoding="UTF-8"?>
232+
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
233+
<aggregation dimName="time" type="joinNew">
234+
<variableAgg name="T"/>
235+
<scan location="/data/goes/" suffix=".gini" dateFormatMark="SUPER-NATIONAL_1km_SFC-T_#yyyyMMdd_HHmm"
236+
numericTimeSettings="int minutes since 2015-06-07T12:00:00Z"/>
237+
</aggregation>
238+
</netcdf>
239+
~~~
240+
224241
## JoinExisting Aggregation
225242

226243
### Name each dataset in a netcdf element and read coordinate values from the files.
@@ -258,30 +275,6 @@ Overrides existing coordinate variable, if any.
258275
</netcdf>
259276
~~~
260277

261-
### Scan directory, assign date coordinate value from filename.
262-
263-
Each file must have exactly one time slice.
264-
The date coordinate must be derivable from the filename, using the `dateFormatMark` attribute.
265-
266-
~~~xml
267-
<?xml version="1.0" encoding="UTF-8"?>
268-
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
269-
<aggregation dimName="time" type="joinExisting">
270-
<scan dateFormatMark="CG#yyyyDDD_HHmmss" location="src/test/data/ncml/nc/cg/" suffix=".nc" subdirs="false" />
271-
</aggregation>
272-
</netcdf>
273-
274-
<?xml version="1.0" encoding="UTF-8"?>
275-
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
276-
<aggregation dimName="time" type="joinExisting" timeUnitsChange="true">
277-
<netcdf location="20060925_0600.nc" ncoords="2"/>
278-
<netcdf location="20060925_1200.nc" ncoords="2"/>
279-
<netcdf location="20060925_1800.nc" ncoords="2"/>
280-
<netcdf location="20060926_0000.nc" ncoords="2"/>
281-
</aggregation>
282-
</netcdf>
283-
~~~
284-
285278
### Name each dataset in a netcdf element and read coordinate values from the files, whose units change.
286279

287280
Add the `timeUnitsChange` attribute.

docs/src/site/pages/netcdfJava/ncmlschema.md

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ Aggregation specific elements are listed in <font color="darkred">red. The forec
2727
<xsd:schema targetNamespace="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"
2828
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
2929
xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"
30-
elementFormDefault="qualified">
30+
elementFormDefault="qualified"
31+
version="2.2.1">
3132
~~~
3233

3334
### netcdf Element
@@ -446,30 +447,31 @@ The aggregation element allows multiple datasets to be combined into a single lo
446447
(11) <xsd:attribute name="olderThan" type="xsd:string" />
447448
(12) <xsd:attribute name="dateFormatMark" type="xsd:string" />
448449
(13) <xsd:attribute name="enhance" type="xsd:string"/>
450+
(14) <xsd:attribute name="numericTimeSettings" type="xsd:string"/>
449451
</xsd:complexType>
450452
</xsd:element>
451453
452-
(14) <xsd:element name="scanFmrc" minOccurs="0" maxOccurs="unbounded">
454+
(15) <xsd:element name="scanFmrc" minOccurs="0" maxOccurs="unbounded">
453455
<xsd:complexType>
454456
(7) <xsd:attribute name="location" type="xsd:string"
455457
(8) <xsd:attribute name="regExp" type="xsd:string" />use="required"/>
456458
(9) <xsd:attribute name="suffix" type="xsd:string" />
457459
(10) <xsd:attribute name="subdirs" type="xsd:boolean" default="true"/>
458460
(11) <xsd:attribute name="olderThan" type="xsd:string" />
459-
(15) <xsd:attribute name="runDateMatcher" type="xsd:string" />
461+
(16) <xsd:attribute name="runDateMatcher" type="xsd:string" />
460462
<xsd:attribute name="forecastDateMatcher" type="xsd:string" />
461463
<xsd:attribute name="forecastOffsetMatcher" type="xsd:string" />
462464
</xsd:complexType>
463465
</xsd:element>
464466
</xsd:sequence>
465467
466-
(16) <xsd:attribute name="type" type="AggregationType" use="required"/>
467-
(17) <xsd:attribute name="dimName" type="xsd:token" />
468-
(18) <xsd:attribute name="recheckEvery" type="xsd:string" />
469-
(19) <xsd:attribute name="timeUnitsChange" type="xsd:boolean"/>
468+
(17) <xsd:attribute name="type" type="AggregationType" use="required"/>
469+
(18) <xsd:attribute name="dimName" type="xsd:token" />
470+
(19) <xsd:attribute name="recheckEvery" type="xsd:string" />
471+
(20) <xsd:attribute name="timeUnitsChange" type="xsd:boolean"/>
470472
471473
<!-- fmrc only -->
472-
(20) <xsd:attribute name="fmrcDefinition" type="xsd:string" />
474+
(21) <xsd:attribute name="fmrcDefinition" type="xsd:string" />
473475
474476
</xsd:complexType>
475477
</xsd:element>
@@ -482,7 +484,7 @@ The aggregation element allows multiple datasets to be combined into a single lo
482484
**promoteGlobalAttribute** element.
483485
4. Specify which variables should be cached (outer aggregation only) with a **cacheVariable** element.
484486
5. Nested **netcdf** datasets can be explicitly listed.
485-
6. Nested netcdf datasets can be implictly specified with a **scan** element.
487+
6. Nested netcdf datasets can be implicitly specified with a **scan** element.
486488
7. The scan directory **location**.
487489
8. If you specify a **regExp**, only files with whose full pathnames match the regular expression will be included.
488490
9. If you specify a **suffix**, only files with that ending will be included. A regExp attribute will override, that is,
@@ -495,17 +497,18 @@ The aggregation element allows multiple datasets to be combined into a single lo
495497
13. You can optionally specify that the files should be opened in **enhance** mode (default is *None*).
496498
Generally you should do this if the ncml needs to operate on the dataset after the CoordSysBuilder has augmented it.
497499
Otherwise, you should not enhance.
498-
14. A specialized **scanFmrc** element can be used for a forecastModelRunSingleCollection aggregation, where forecast
500+
14. **numericTimeSettings** is used in conjunction with **dateFormatMark** to create a numeric, UDUNITS compatible aggregated time variable. See more below.
501+
15. A specialized **scanFmrc** element can be used for a forecastModelRunSingleCollection aggregation, where forecast
499502
model run data is stored in multiple files, with one forecast time per file.
500-
15. For scanFmrc, the run date and the forecast date is extracted from the file pathname using a **runDateMatcher** and
503+
16. For scanFmrc, the run date and the forecast date is extracted from the file pathname using a **runDateMatcher** and
501504
either a **forecastDateMatcher** or a **forecastOffsetMatcher** attribute. See more below.
502-
16. You must specify an **aggregation type**.
503-
17. For all types except joinUnion, you must specify the **dimension name** to join.
504-
18. The **recheckEvery** allows you to rescan periodically to see if the set of files has changed.
505-
19. Only for *joinExisting* and *forecastModelRunCollection* types: if **timeUnitsChange** is set to true, the units of the
505+
17. You must specify an **aggregation type**.
506+
18. For all types except joinUnion, you must specify the **dimension name** to join.
507+
19. The **recheckEvery** allows you to rescan periodically to see if the set of files has changed.
508+
20. Only for *joinExisting* and *forecastModelRunCollection* types: if **timeUnitsChange** is set to true, the units of the
506509
joined coordinate variable may change, so examine them and do any appropriate conversion so that the aggregated
507510
coordinate values have consistent units.
508-
20. Experimental, do not use.
511+
21. Experimental, do not use.
509512

510513
##### DateFormatMark
511514
A **dateFormatMark** is used on joinNew types to create date coordinate values out of the filename. It consists of a
@@ -521,6 +524,16 @@ A **dateFormatMark** is used on joinNew types to create date coordinate values o
521524
in which case the coordinate values of the time can be created from the filename, instead of having to open each file
522525
and read it.
523526

527+
##### numericTimeSettings
528+
**numericTimeSettings** can be combined with a **dateFormatMark** to produce a numeric, UDUNITS compatible time variable.
529+
**numericTimeSettings** consists of a data type plus a UDUNITS compatible time unit.
530+
Care must be taken when choosing these parameters to prevent truncation.
531+
```
532+
Filename: SUPER-NATIONAL_1km_SFC-T_20051206_2300.gini
533+
DateFormatMark: SUPER-NATIONAL_1km_SFC-T_#yyyyMMdd_HHmm
534+
numericTimeSettings: int minutes since 2005-12-01T00:00:00Z"
535+
```
536+
524537
##### ScanFmrc
525538

526539
The run date and the forecast date is extracted from the file pathname using a **runDateMatcher** and

docs/src/site/pages/netcdfJava_tutorial/ncml/NcmlAggregation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ These are the ways that coordinate values may be assigned to a `joinExisting` co
235235
</aggregation>
236236
~~~
237237
* If there is exactly one time slice in each file of the `joinExisting` aggregation, and you are using a scan element to dynamically scan the files in a directory, then you can use the `dateFormatMark` attribute to derive the date from the filename.
238+
* You can combine `dateFormatMark` with `numericTimeSettings` to produce a time variable with numeric values and a UDUNITS compatible unit.
238239
* If you do not specify a coordinate variable, one must exist in each of the nested datasets, and the coordinate values will be read from it, just like any other aggregation variable.
239240
In this case, when the units of the aggregation coordinate change on the existing coordinate variables, you must add **timeUnitsChange=\"true\"** on the aggregation element:
240241
~~~xml

0 commit comments

Comments
 (0)