- pyart.io.write_grid_geotiff(grid, filename, field, rgb=False, level=None, cmap='viridis', vmin=0, vmax=75, color_levels=None, warp=False, sld=False, use_doublequotes=True)[source]¶
Write a Py-ART Grid object to a GeoTIFF file.
The GeoTIFF can be the standard Azimuthal Equidistant projection used in Py-ART, or a lat/lon projection on a WGS84 sphere. The latter is typically more usable in web mapping applications. The GeoTIFF can contain a single float-point raster band, or three RGB byte raster bands. The former will require an SLD file for colorful display using standard GIS or web mapping software, while the latter will show colors “out-of-the-box” but lack actual data values. The function also can output an SLD file based on the user-specified inputs. User can specify the 2D vertical level to be output. If this is not specified, a 2D composite is created. User also can specify the field to output.
This function requires GDAL Python libraries to be installed. These are available via conda; e.g., ‘conda install gdal’
grid (pyart.core.Grid object) – Grid object to write to file.
filename (str) – Filename for the GeoTIFF.
field (str) – Field name to output to file.
- Other Parameters
rbg (bool, optional) – True - Output 3-band RGB GeoTIFF
- False - Output single-channel, float-valued GeoTIFF. For display,
likely will need an SLD file to provide a color table.
level (int or None, optional) – Index for z-axis plane to output. None gives composite values (i.e., max in each vertical column).
cmap (str or matplotlib.colors.Colormap object, optional) – Colormap to use for RGB output or SLD file.
vmin (int or float, optional) – Minimum value to color for RGB output or SLD file.
vmax (int or float, optional) – Maximum value to color for RGB output or SLD file.
color_levels (int or None, optional) – Number of color levels in cmap. Useful for categorical colormaps with steps << 255 (e.g., hydrometeor ID).
warp (bool, optional) –
- True - Use gdalwarp (called from command line using os.system)
to warp to a lat/lon WGS84 grid.
False - No warping will be performed. Output will be Az. Equidistant.
sld (bool, optional) –
- True - Create a Style Layer Descriptor file (SLD) mapped to vmin/vmax
and cmap. File is named same as output TIFF, except for .sld extension.
False - Don’t do this.
use_doublequotes (bool, optional) –
- True - Use double quotes in the gdalwarp call (requires warp=True),
which may help if that command is producing and error like: ‘Translating source or target SRS failed’.
False - Use single quotes instead.