Module Expr Str ImportFrom alias Import alias identifier Import alias identifier Import alias identifier Import alias Import alias ImportFrom alias TryExcept body ImportFrom alias Assign NameStore NameLoad handlers ExceptHandler type NameLoad body Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad Str Num Num NameLoad NameLoad NameLoad body Expr Str If UnaryOpNot NameLoad body Raise Call NameLoad Str If CompareNotIn NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr body Raise Call NameLoad Str NameLoad Str If CompareNotIn Str NameLoad body Assign NameStore NameLoad Assign NameStore Str Assign NameStore BinOpAdd BinOpAdd NameLoad Str NameLoad orelse Assign NameStore NameLoad Assign TupleStore NameStore NameStore NameStore AttributeLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str attr Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Str Assign NameStore BinOpSub SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index Str Index Num SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index Str Index Num Assign NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index Str Index Num Assign NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index Str Index Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str keyword Num If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num orelse Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Index CompareEq NameLoad Num AttributeLoad NameLoad attr Assign NameStore BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Str Str Str Str Str Call NameLoad NameLoad Str Str Call NameLoad NameLoad Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr Str If UnaryOpNot NameLoad body Assign NameStore ListLoad Str Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num Num AttributeLoad NameLoad attr NameLoad orelse Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num Num AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr ListLoad UnaryOpUSub NameLoad UnaryOpUSub NameLoad Num NameLoad Num NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot NameLoad body Expr Call AttributeLoad Call AttributeLoad NameLoad attr Num attr SubscriptLoad NameLoad ExtSlice Slice Num Slice orelse Expr Call AttributeLoad Call AttributeLoad NameLoad attr Num attr SubscriptLoad NameLoad ExtSlice Slice Num Slice Expr Call AttributeLoad Call AttributeLoad NameLoad attr Num attr SubscriptLoad NameLoad ExtSlice Slice Num Slice Expr Call AttributeLoad Call AttributeLoad NameLoad attr Num attr SubscriptLoad NameLoad ExtSlice Slice Num Slice Expr Call AttributeLoad NameLoad attr Assign NameStore NameLoad If NameLoad body Expr Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Str NameLoad Str NameLoad Str Expr Call AttributeLoad NameLoad attr BinOpAdd NameLoad Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore BinOpDiv BinOpSub NameLoad NameLoad Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Num Assign NameStore Call AttributeLoad BinOpMult NameLoad NameLoad attr Assign SubscriptStore NameLoad Index CompareLt NameLoad Num Num Assign SubscriptStore NameLoad Index CompareGt NameLoad Num Num Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad For NameStore NameLoad body If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpMult NameLoad Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpMult NameLoad Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpMult NameLoad Num orelse Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Return TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Num Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Str Assign NameStore BinOpAdd NameLoad Str Assign NameStore Call NameLoad NameLoad Str Assign NameStore BinOpAdd BinOpAdd Str Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad For NameStore Call AttributeLoad NameLoad attr BinOpAdd NameLoad Num body Assign NameStore BinOpAdd BinOpDiv BinOpMult NameLoad BinOpSub NameLoad NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad If CompareEq NameLoad Num body Assign NameStore Num orelse Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num Num Assign NameStore BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Call AttributeLoad Call NameLoad NameLoad attr Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list
N/A N/A 
pyart.io.write_grid_geotiff
===========================

Write a Py-ART Grid object to a GeoTIFF file.

.. autosummary::
    :toctree: generated/

    write_grid_geotiff
    _get_rgb_values
    _create_sld

 __future__ division N/A numpy np N/A matplotlib.pyplot plt N/A matplotlib.colors colors N/A os N/A shutil exceptions MissingOptionalDependency N/A N/A osgeo gdal N/A IMPORT_FLAG True N/A N/A N/A ImportError N/A N/A IMPORT_FLAG False write_grid_geotiff N/A N/A grid filename field rgb level cmap vmin vmax color_levels warp sld N/A False None viridis 0 75 None False False N/A N/A 
    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'

    Parameters
    ----------
    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.

     N/A N/A IMPORT_FLAG N/A N/A N/A MissingOptionalDependency GDAL not detected, GeoTIFF output failure! N/A N/A field N/A N/A N/A grid fields keys N/A N/A N/A KeyError Failed - field field not found in Grid object. N/A N/A . filename N/A N/A name filename N/A end tif N/A ofile N/A N/A name . end N/A N/A ofile filename N/A N/A nz ny nx N/A N/A N/A N/A grid fields N/A field N/A data shape N/A dist N/A max N/A N/A grid x N/A data N/A rangestep N/A N/A N/A N/A grid x N/A data N/A 1 N/A N/A N/A grid x N/A data N/A 2 N/A lat N/A N/A N/A grid origin_latitude N/A data N/A 0 N/A lon N/A N/A N/A grid origin_longitude N/A data N/A 0 N/A filled N/A N/A N/A np ma filled N/A N/A N/A grid fields N/A field N/A data fill_value -32768 N/A N/A level None N/A N/A data N/A N/A np amax filled 0 N/A N/A data N/A filled N/A level N/A data N/A N/A data astype float N/A N/A data N/A N/A data -32768 N/A np nan N/A iproj N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A PROJCS["unnamed",GEOGCS["WGS 84",DATUM["unknown", SPHEROID["WGS84",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]], PROJECTION["Azimuthal_Equidistant"], PARAMETER["latitude_of_center", N/A str lat ], PARAMETER["longitude_of_center", N/A str lon ], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["metre",1,AUTHORITY["EPSG","9001"]]] N/A out_driver N/A N/A gdal GetDriverByName GTiff N/A N/A rgb N/A N/A dst_options N/A COMPRESS=LZW ALPHA=YES N/A dst_ds N/A N/A out_driver Create ofile N/A N/A data shape N/A 1 N/A N/A data shape N/A 0 1 N/A gdal GDT_Float32 dst_options N/A N/A N/A rarr garr barr N/A _get_rgb_values data vmin vmax color_levels cmap N/A dst_ds N/A N/A out_driver Create ofile N/A N/A data shape N/A 1 N/A N/A data shape N/A 0 3 N/A gdal GDT_Byte N/A N/A N/A dst_ds SetGeoTransform N/A N/A dist N/A rangestep 0 dist 0 rangestep N/A N/A N/A dst_ds SetProjection iproj N/A N/A rgb N/A N/A N/A N/A N/A N/A dst_ds GetRasterBand 1 WriteArray N/A data N/A N/A -1 N/A N/A N/A N/A N/A N/A N/A dst_ds GetRasterBand 1 WriteArray N/A rarr N/A N/A -1 N/A N/A N/A N/A N/A N/A dst_ds GetRasterBand 2 WriteArray N/A garr N/A N/A -1 N/A N/A N/A N/A N/A N/A dst_ds GetRasterBand 3 WriteArray N/A barr N/A N/A -1 N/A N/A N/A N/A dst_ds FlushCache N/A dst_ds None N/A sld N/A N/A N/A _create_sld cmap vmin vmax ofile color_levels N/A warp N/A N/A N/A N/A os system N/A N/A N/A N/A N/A gdalwarp -q -t_srs '+proj=longlat +ellps=WGS84  +datum=WGS84 +no_defs'  ofile ofile _tmp.tif N/A N/A N/A shutil move N/A ofile _tmp.tif ofile N/A _get_rgb_values N/A N/A data vmin vmax color_levels cmap N/A N/A N/A 
    Get RGB values for later output to GeoTIFF, given a 2D data field,
    display min/max and color table info. Missing data get numpy.nan.
    Only called if rgb is True in write_grid_geotiff.

    Parameters
    ----------
    data : numpy.ndarray object, dtype int or float
        Two-dimensional data array
    vmin : int or float
        Minimum value to color for RGB output or SLD file.
    vmax : int or float
        Maximum value to color for RGB output or SLD file.
    color_levels : int
        Number of color levels in cmap. Useful for categorical colormaps
        with steps << 255 (e.g., hydrometeor ID).
    cmap : str or matplotlib.colors.Colormap object, optional
        Colormap to use for RGB output or SLD file.

    Returns
    -------
    rarr : numpy.ndarray object, dtype int
        Red channel indices (range = 0-255)
    barr : numpy.ndarray object, dtype int
        Blue channel indices (range = 0-255)
    garr : numpy.ndarray object, dtype int
        Green channel indices (range = 0-255)

     N/A frac N/A N/A data vmin N/A N/A np float N/A vmax vmin N/A N/A color_levels None N/A N/A color_levels 255 N/A index N/A N/A N/A frac color_levels ravel N/A N/A index N/A N/A index 0 0 N/A N/A index N/A N/A index 255 255 N/A rarr N/A N/A garr N/A N/A barr N/A N/A cmap N/A N/A N/A plt cm get_cmap cmap N/A val index N/A N/A N/A N/A N/A np isnan val N/A N/A ind N/A N/A np int N/A N/A np round val N/A N/A r g b t N/A cmap ind N/A N/A N/A rarr append N/A N/A np int N/A N/A np round N/A r 255 N/A N/A N/A garr append N/A N/A np int N/A N/A np round N/A g 255 N/A N/A N/A barr append N/A N/A np int N/A N/A np round N/A b 255 N/A N/A N/A N/A rarr append N/A np nan N/A N/A N/A garr append N/A np nan N/A N/A N/A barr append N/A np nan N/A rarr N/A N/A np reshape rarr N/A data shape N/A garr N/A N/A np reshape garr N/A data shape N/A barr N/A N/A np reshape barr N/A data shape N/A N/A rarr garr barr N/A _create_sld N/A N/A cmap vmin vmax filename color_levels N/A None N/A N/A 
    Develop a Style Layer Descriptor file given a color table and
    user-specified min/max files. Output color info to that file.
    Only called if sld is True in write_grid_geotiff.

    Parameters
    ----------
    cmap : str or matplotlib.colors.Colormap object, optional
        Colormap to use for RGB output or SLD file.
    vmin : int or float
        Minimum value to color for RGB output or SLD file.
    vmax : int or float
        Maximum value to color for RGB output or SLD file.
    filename : str
        Template for SLD filename. The suffix (presumably .tif or .tiff)
        is removed and replaced with .sld. Thus, if provided a filename
        radar_reflectivity.tif, the output SLD file will be called
        radar_reflectivity.sld.

    Other Parameters
    ----------------
    color_levels : int or None, optional
        Number of color levels in cmap. Useful for categorical colormaps
        with steps << 255 (e.g., hydrometeor ID).

     N/A cmap N/A N/A N/A plt cm get_cmap cmap N/A N/A color_levels None N/A N/A color_levels 255 N/A N/A name end N/A N/A filename split . N/A ofile N/A name .sld N/A fileobj N/A open ofile w N/A header N/A N/A <?xml version="1.0" encoding="UTF-8"?>
<sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" version="1.0.0">
    <sld:UserLayer>
        <sld:LayerFeatureConstraints>
            <sld:FeatureTypeConstraint/>
        </sld:LayerFeatureConstraints>
        <sld:UserStyle>
            <sld:Name> N/A str name </sld:Name>
            <sld:FeatureTypeStyle>
                <sld:Name>name</sld:Name>
                <sld:FeatureTypeName>Feature</sld:FeatureTypeName>
                <sld:Rule>
                    <sld:RasterSymbolizer>
                        <sld:ColorMap> N/A N/A N/A fileobj write header N/A i N/A N/A np arange N/A color_levels 1 N/A N/A val N/A N/A N/A i N/A vmax vmin color_levels vmin N/A rgbt N/A cmap i N/A N/A i 0 N/A N/A op 0.0 N/A N/A op 1.0 N/A hexval N/A N/A colors rgb2hex N/A rgbt N/A 0 3 N/A wstr N/A N/A N/A N/A N/A N/A 
                            <sld:ColorMapEntry color=" N/A N/A N/A str hexval upper " opacity=" N/A str op " quantity=" N/A str val "/> N/A N/A N/A fileobj write wstr N/A footer 
                        </sld:ColorMap>
                    </sld:RasterSymbolizer>
                </sld:Rule>
            </sld:FeatureTypeStyle>
        </sld:UserStyle>
    </sld:UserLayer>
</sld:StyledLayerDescriptor>
 N/A N/A N/A fileobj write footer N/A N/A N/A fileobj close N/A