You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Array sections can be specified with Fortran 90 array section syntax, using zero-based indexing. For example:
13
+
14
+
`/group1/group2/varName(12:22,0:100:2,:,17)`
15
+
16
+
specifies an array section for a four-dimensional variable:
17
+
18
+
1.`12:22` includes all the elements from 12 to 22 inclusive
19
+
1.`0:100:2` includes the elements from 0 to 100 inclusive, with a stride of 2
20
+
1.`:` includes all the elements
21
+
1.`17` includes just the 18th element.
22
+
23
+
For structures, you can specify nested selectors, e.g. `record(12).wind(1:20,:,3)` does a selection on the `wind` member variable of the `record` structure at index 12.
24
+
If you don’t specify a section, it means read the entire variable, e.g. `record.wind` means all the data in all the wind variables in all the record structures.
25
+
26
+
Formally:
27
+
28
+
```
29
+
sectionSpec := selector | selector '.' selector
30
+
selector := varName ['(' sectionSpec ')']
31
+
varName := STRING
32
+
sectionSpec := dim | dim ',' sectionSpec
33
+
dim := ':' | slice | start ':' end | start ':' end ':' stride
34
+
35
+
36
+
slice := INTEGER
37
+
start := INTEGER
38
+
stride := INTEGER
39
+
end := INTEGER
40
+
STRING := String with escaped chars = '.', '/', '(', and ')'
41
+
```
42
+
43
+
where:
44
+
45
+
* Nonterminals are in lower case, terminals are in upper case, and literals are in single quotes.
46
+
* Optional components are enclosed between square braces `[` and `]`.
47
+
48
+
TBD:
49
+
50
+
* escape mechanism is currently %xx , mostly following opendap
51
+
* not sure if any other chars need to be escaped.
52
+
53
+
### Restrictions
54
+
55
+
A Sequence is a one-dimensional Structure with a variable length, it cannot be subsetted.
56
+
57
+
A variable long name must be used, that is with its group names: `/group1/group2/varName`
Below are useful command-line utilities that can be called from the CDM library.
10
-
The easiest way to use these is to grab the latest netcdfAll.jar file.
10
+
One way to use these tools is to grab the latest netcdfAll.jar or toolsUI.jar file from the [Unidata downloads page](https://downloads.unidata.ucar.edu/netcdf-java/){:target="_blank"} or the [netCDF-Java GitHub releases page](https://github.com/Unidata/netcdf-java/releases){:target="_blank"}.
11
+
However, a super handy [community-led effort](https://github.com/conda-forge/netcdf-java-feedstock){:target="_blank"} makes JAR management and a set of convenient wrapper scripts (`.sh` and `.bat`) available through `conda-forge`:
12
+
13
+
```bash
14
+
conda install -c conda-forge netcdf-java
15
+
```
16
+
17
+
## Utilities
11
18
12
19
*[ncdump](#ncdump): prints the textual representation of a dataset to standard output
13
20
*[nccopy](#nccopy): copies a CDM dataset to a netCDF-3 (default) or netCDF-4 file
@@ -17,7 +24,6 @@ The easiest way to use these is to grab the latest netcdfAll.jar file.
17
24
*[CFPointWriter](#cfpointwriter): copies a CDM point feature dataset to CF/NetCDF format
Note that the output file is placed in the root directory of the collection, as specified by the [Collection Specification string](https://docs.unidata.ucar.edu/tds/current/userguide/collection_spec_string_ref.html){:target="_blank"} of the GRIB [`<featureCollection>`](grib_feature_collections_ref.html).
177
192
193
+
The conda wrapper script is named `ncj-gribcdmindex`.
194
+
178
195
## FeatureScan
179
196
180
197
Scans all the files in a directory to see if they are [CDM files](file_types.html) and can be identified as a particular feature type.
Copy file name to clipboardExpand all lines: docs/src/site/pages/netcdfJava_tutorial/cdmdatasets/readingcdm.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,7 @@ Note that you can edit the `Variable`'s ranges (`T(0:30:10, 1, 0:3)` in this exa
54
54
These are expressed with Fortran 90 array section syntax, using zero-based indexing.
55
55
For example, `varName( 12:22 , 0:100:2, :, 17)` specifies an array section for a four dimensional variable.
56
56
The first dimension includes all the elements from 12 to 22 inclusive, the second dimension includes the elements from 0 to 100 inclusive with a stride of 2, the third includes all the elements in that dimension, and the fourth includes just the 18th element.
57
+
The [CDM section specification](section_specification_ref.html) describes the section string syntax in more detail.
57
58
58
59
The following code to dump data from your program is equivalent to the above ToolsUI actions:
59
60
@@ -98,20 +99,22 @@ Or suppose you want to loop over all time steps, and make it general to handle a
98
99
In this case, we call reduce(0), to reduce dimension 0, which we know has length one, but leave the other two dimensions alone.
99
100
100
101
Note that `varShape` holds the total number of elements that can be read from the variable; `origin` is the starting index, and `size` is the number of elements to read.
101
-
This is different from the Fortran 90 array syntax, which uses the starting and ending array indices (inclusive):
102
+
This is different from the section (Fortran 90) array syntax, which uses the starting and ending array indices (inclusive):
0 commit comments