1r3.out.netcdf(1) Grass User's Manual r3.out.netcdf(1)
2
3
4
6 r3.out.netcdf - Export a 3D raster map as netCDF file.
7
9 raster3d, export, output, netCDF, voxel
10
12 r3.out.netcdf
13 r3.out.netcdf --help
14 r3.out.netcdf [-pm] input=name output=name [null=float] [--over‐
15 write] [--help] [--verbose] [--quiet] [--ui]
16
17 Flags:
18 -p
19 Export projection information as wkt and proj4 parameter
20
21 -m
22 Use 3D raster mask (if exists) with input map
23
24 --overwrite
25 Allow output files to overwrite existing files
26
27 --help
28 Print usage summary
29
30 --verbose
31 Verbose module output
32
33 --quiet
34 Quiet module output
35
36 --ui
37 Force launching GUI dialog
38
39 Parameters:
40 input=name [required]
41 Name of input 3D raster map
42
43 output=name [required]
44 Name for netCDF output file
45
46 null=float
47 The value to be used for null values, default is the netCDF stan‐
48 dard
49
51 The module r3.out.netcdf exports a 3D raster map as netCDF file. Maps
52 are valid 3D raster maps in the current mapset search path. The output
53 parameter is the name of a netCDF file that will be written in the cur‐
54 rent working directory. The module is sensitive to mapset region set‐
55 tings (set with g.region) and the vertical unit settings of the 3D
56 raster map. The vertical unit can be set with r3.support.
57
59 The resulting netCDF file will have time as third dimension in case a
60 temporal vertical unit is specified for the input map, otherwise the
61 third dimension is assumed as spatial. If the 3D raster map has a time
62 stamp with absolute time, the start time will be used as starting point
63 for the netCDF time series. If the absolute time stamp is missing the
64 date "Jan. 01. 1900 00:00:00" will be used as default. In case of rela‐
65 tive time stamp no start time is set in the netCDF file. The number of
66 depths of the 3D raster map are the number of time slices in the netCDF
67 file. You can use t.rast.to.rast3 to convert a space time raster
68 dataset into a 3D raster map representing a space time voxel cube, then
69 export the raster time series as netCDF file.
70
71 Spatial coordinates are exported as cell centered coordinates. The pro‐
72 jection can be optionally stored in the metadata as crs attributes .
73 The netCDF projection metadata storage follows the spatial_ref
74 GDAL/netCDF suggestion here and the netCDF CF 1.6 convention here using
75 WKT projection information. Additional a PROJ.4 string is stored in the
76 crs attribute section. The export of projection parameters is sup‐
77 pressed when the XY-projection is set.
78
79 The range of the 3D raster map is set in the netCDF output file.
80 Optionally a the netCDF missing value and _FillValue can be set using
81 the null option. As default the netCDF floating point _FillValues are
82 used to fill empty cell.
83
84 The netCDF library must be installed on the system and activated at
85 configuration time to compile this module.
86
88 g.region s=-90 n=90 w=-180 e=180 b=0 t=5 res=10 res3=10 tbres=1 -p3
89 #####################################################################
90 # We create a simple volume map with floating point values
91 #####################################################################
92 r3.mapcalc --o expr="volume_float = float(col() + row() + depth())"
93 r3.info volume_float
94 +----------------------------------------------------------------------------+
95 | Layer: volume_float Date: Thu Jun 14 08:40:56 2012 |
96 | Mapset: PERMANENT Login of Creator: soeren |
97 | Location: TestLL |
98 | DataBase: /1/soeren/grassdata |
99 | Title: volume_float |
100 | Units: none |
101 | Vertical unit: units |
102 | Timestamp: none |
103 |----------------------------------------------------------------------------|
104 | |
105 | Type of Map: 3d cell Number of Categories: 0 |
106 | Data Type: FCELL |
107 | Rows: 18 |
108 | Columns: 36 |
109 | Depths: 5 |
110 | Total Cells: 3240 |
111 | Total size: 10114 Bytes |
112 | Number of tiles: 1 |
113 | Mean tile size: 10114 Bytes |
114 | Tile size in memory: 12960 Bytes |
115 | Number of tiles in x, y and z: 1, 1, 1 |
116 | Dimension of a tile in x, y, z: 36, 18, 5 |
117 | |
118 | Projection: Latitude-Longitude (zone 0) |
119 | N: 90N S: 90S Res: 10 |
120 | E: 180E W: 180W Res: 10 |
121 | T: 5 B: 0 Res: 1 |
122 | Range of data: min = 3 max = 59 |
123 | |
124 | Data Source: |
125 | |
126 | |
127 | |
128 | Data Description: |
129 | generated by r3.mapcalc |
130 | |
131 | Comments: |
132 | r3.mapcalc expression="volume_float = float(col() + row() + depth())" |
133 | |
134 +----------------------------------------------------------------------------+
135 #####################################################################
136 # We use the netCDF ncdump tool to have a look at the header
137 # and coordinates of the exported netCDF file
138 #####################################################################
139 r3.out.netcdf --o input=volume_float output=test_float.nc
140 ncdump -c test_float.nc
141 netcdf test_float {
142 dimensions:
143 longitude = 36 ;
144 latitude = 18 ;
145 z = 5 ;
146 variables:
147 float longitude(longitude) ;
148 longitude:units = "degrees_east" ;
149 longitude:long_name = "Longitude values" ;
150 longitude:standard_name = "longitude" ;
151 longitude:axis = "X" ;
152 float latitude(latitude) ;
153 latitude:units = "degrees_north" ;
154 latitude:long_name = "Latitude values" ;
155 latitude:standard_name = "latitude" ;
156 latitude:axis = "Y" ;
157 float z(z) ;
158 z:units = "meter" ;
159 z:long_name = "z coordinate of projection" ;
160 z:standard_name = "projection_z_coordinate" ;
161 z:positive = "up" ;
162 z:axis = "Z" ;
163 float volume_float(z, latitude, longitude) ;
164 volume_float:valid_min = 3.f ;
165 volume_float:valid_max = 59.f ;
166 // global attributes:
167 :Conventions = "CF-1.5" ;
168 :history = "GRASS GIS 7 netCDF export of r3.out.netcdf" ;
169 data:
170 longitude = -175, -165, -155, -145, -135, -125, -115, -105, -95, -85, -75,
171 -65, -55, -45, -35, -25, -15, -5, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95,
172 105, 115, 125, 135, 145, 155, 165, 175 ;
173 latitude = 85, 75, 65, 55, 45, 35, 25, 15, 5, -5, -15, -25, -35, -45, -55,
174 -65, -75, -85 ;
175 z = 0.5, 1.5, 2.5, 3.5, 4.5 ;
176 }
177 #####################################################################
178 # Exporting the projection specific settings and a null value
179 #####################################################################
180 r3.out.netcdf --o -p null=-1 input=volume_float output=test_float.nc
181 ncdump -c test_float.nc
182 netcdf test_float {
183 dimensions:
184 longitude = 36 ;
185 latitude = 18 ;
186 z = 5 ;
187 variables:
188 char crs ;
189 crs:crs_wkt = "GEOGCS[\"wgs84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]]" ;
190 crs:spatial_ref = "GEOGCS[\"wgs84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]]" ;
191 crs:crs_proj4 = " +proj=longlat +no_defs +a=6378137 +rf=298.257223563 +towgs84=0.000,0.000,0.000" ;
192 float longitude(longitude) ;
193 longitude:units = "degrees_east" ;
194 longitude:long_name = "Longitude values" ;
195 longitude:standard_name = "longitude" ;
196 longitude:axis = "X" ;
197 float latitude(latitude) ;
198 latitude:units = "degrees_north" ;
199 latitude:long_name = "Latitude values" ;
200 latitude:standard_name = "latitude" ;
201 latitude:axis = "Y" ;
202 float z(z) ;
203 z:units = "meter" ;
204 z:long_name = "z coordinate of projection" ;
205 z:standard_name = "projection_z_coordinate" ;
206 z:positive = "up" ;
207 z:axis = "Z" ;
208 float volume_float(z, latitude, longitude) ;
209 volume_float:valid_min = 3.f ;
210 volume_float:valid_max = 59.f ;
211 volume_float:missing_value = -1.f ;
212 volume_float:_FillValue = -1.f ;
213 volume_float:grid_mapping = "crs" ;
214 // global attributes:
215 :Conventions = "CF-1.5" ;
216 :history = "GRASS GIS 7 netCDF export of r3.out.netcdf" ;
217 data:
218 longitude = -175, -165, -155, -145, -135, -125, -115, -105, -95, -85, -75,
219 -65, -55, -45, -35, -25, -15, -5, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95,
220 105, 115, 125, 135, 145, 155, 165, 175 ;
221 latitude = 85, 75, 65, 55, 45, 35, 25, 15, 5, -5, -15, -25, -35, -45, -55,
222 -65, -75, -85 ;
223 z = 0.5, 1.5, 2.5, 3.5, 4.5 ;
224 }
225 #####################################################################
226 # Assigning time as vertical unit and setting an absolute time stamp
227 #####################################################################
228 r3.timestamp map=volume_float date=’1 Jan 2001/5 Jan 2001’
229 r3.support map=volume_float vunit="days"
230 r3.out.netcdf --o -p null=-1 input=volume_float output=test_float.nc
231 ncdump -c test_float.nc
232 netcdf test_float {
233 dimensions:
234 longitude = 36 ;
235 latitude = 18 ;
236 time = 5 ;
237 variables:
238 char crs ;
239 crs:crs_wkt = "GEOGCS[\"wgs84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]]" ;
240 crs:spatial_ref = "GEOGCS[\"wgs84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]]" ;
241 crs:crs_proj4 = " +proj=longlat +no_defs +a=6378137 +rf=298.257223563 +towgs84=0.000,0.000,0.000" ;
242 float longitude(longitude) ;
243 longitude:units = "degrees_east" ;
244 longitude:long_name = "Longitude values" ;
245 longitude:standard_name = "longitude" ;
246 longitude:axis = "X" ;
247 float latitude(latitude) ;
248 latitude:units = "degrees_north" ;
249 latitude:long_name = "Latitude values" ;
250 latitude:standard_name = "latitude" ;
251 latitude:axis = "Y" ;
252 int time(time) ;
253 time:units = "days since 2001-01-01 00:00:00" ;
254 time:long_name = "Time in days" ;
255 time:calendar = "gregorian" ;
256 time:positive = "up" ;
257 time:axis = "T" ;
258 float volume_float(time, latitude, longitude) ;
259 volume_float:valid_min = 3.f ;
260 volume_float:valid_max = 59.f ;
261 volume_float:missing_value = -1.f ;
262 volume_float:_FillValue = -1.f ;
263 volume_float:grid_mapping = "crs" ;
264 // global attributes:
265 :Conventions = "CF-1.5" ;
266 :history = "GRASS GIS 7 netCDF export of r3.out.netcdf" ;
267 data:
268 longitude = -175, -165, -155, -145, -135, -125, -115, -105, -95, -85, -75,
269 -65, -55, -45, -35, -25, -15, -5, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95,
270 105, 115, 125, 135, 145, 155, 165, 175 ;
271 latitude = 85, 75, 65, 55, 45, 35, 25, 15, 5, -5, -15, -25, -35, -45, -55,
272 -65, -75, -85 ;
273 time = 0, 1, 2, 3, 4 ;
274 }
275
277 t.rast.to.rast3, r3.in.ascii, g.region
278
280 Sören Gebbert
281
283 Available at: r3.out.netcdf source code (history)
284
285 Main index | 3D raster index | Topics index | Keywords index | Graphi‐
286 cal index | Full index
287
288 © 2003-2019 GRASS Development Team, GRASS GIS 7.8.2 Reference Manual
289
290
291
292GRASS 7.8.2 r3.out.netcdf(1)