The examples below show how SILO’s NetCDF files can be converted to either
SILO’s gridded datasets are arranged in annual blocks. The examples show how the gridded dataset for a single day can be extracted from an annual file and converted to the desired format.
The examples use the Geospatial Data Abstraction Library (GDAL). See the GDAL binaries page for installation instructions, or you may wish to compile from source.
NOTE: It is recommended that a recent version of GDAL be used. Old versions may produce unexpected results.
The following examples have been tested on:
The following command:
gdal_translate [annual_netcdf_file] \
[daily_arcascii_file] -of AAIGrid -ot Float32 -b [day_of_year] \
-unscale -a_nodata [missing_value] -co "DECIMAL_PRECISION=1"
will extract a single time-slice (day_of_year
) from the input NetCDF file ( annual_netcdf_file
), and output an ArcASCII file (daily_arcascii_file
) in 32-bit floating point format (Float32
) written with one decimal place ( "DECIMAL_PRECISION=1"
).
For example, to extract the daily grid for 1 September 1970 (244th day in the year) in ArcASCII format:
1970.max_temp.nc
). This can be done using a variety of methods.19700901.max_temp.asc
:
gdal_translate 1970.max_temp.nc 19700901.max_temp.asc \
-of AAIGrid -ot Float32 -b 244 -unscale -a_nodata -3276.7 \
-co "DECIMAL_PRECISION=1"
The following commands:
gdal_translate [annual_netcdf_file] tmp.nc \
-of NetCDF -ot Float32 -b [day_of_year] -unscale -a_nodata [fill_value] \
-a_srs [grid_projection]
gdaldem color-relief tmp.nc [colour_map_file] [daily_geotiff_file] \
-of GTiff -alpha -nearest_color_entry -co "COMPRESS=DEFLATE"
will output the desired time-slice in GeoTiff format. The first command ( gdal_translate
…) extracts the time-slice into a temporary NetCDF file (tmp.nc
). The second command (gdaldem
…) converts the temporary NetCDF file into a GeoTiff image using the given colour map (colour_map_file
) and compression options (COMPRESS=DEFLATE
).
A colour map is a text file specifying the colours used for mapping raster data to colour values. You may wish to use these sample maps which SILO constructed from images taken from the Bureau of Meteorology’s Climate Maps website:
For example, to extract the daily grid for 1 September 1970 (244th day in the year) in GeoTiff format:
1970.max_temp.nc
). This can be done using a variety of methods.ncdump -h 1970.max_temp.nc
gdal_translate 1970.max_temp.nc 19700901.max_temp.nc \
-of NetCDF -a_nodata -3276.7 -ot Float32 -b 244 -unscale -a_srs epsg:4326
(assuming add_offset was 0.0 and scale_factor was 0.1).gdaldem color-relief 19700901.max_temp.nc max_temp.clr \
19700901.max_temp.tif -of GTiff -alpha -nearest_color_entry \
-co "COMPRESS=DEFLATE"