Debian Codegraph @

raster3d/r3.out.netcdf/r3.out.netcdf.html

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