MCPcopy Create free account
hub / github.com/NCAR/wrf-python / geo_bounds

Function geo_bounds

src/wrf/util.py:3118–3256  ·  view source on GitHub ↗

Return the geographic boundaries for the variable or file(s). When using a :class:`xarray.DataArray` as the *var* parameter, the variable must contain latitude and longitude coordinates. If these coordinate dimensions are greater than two dimensions, then an array of :class:`wrf.Ge

(var=None, wrfin=None, varname=None, timeidx=0, method="cat",
               squeeze=True, cache=None)

Source from the content-addressed store, hash-verified

3116
3117
3118def geo_bounds(var=None, wrfin=None, varname=None, timeidx=0, method="cat",
3119 squeeze=True, cache=None):
3120 """Return the geographic boundaries for the variable or file(s).
3121
3122 When using a :class:`xarray.DataArray` as the *var* parameter, the variable
3123 must contain latitude and longitude coordinates. If these coordinate
3124 dimensions are greater than two dimensions, then an array of
3125 :class:`wrf.GeoBounds` objects will be returned with the same shape as the
3126 leftmost dimensions of the coordinate arrays.
3127
3128 When using a WRF file, or sequence of WRF files, by supplying the
3129 *wrfin* parameter, an array of :class:`wrf.GeoBounds` objects will be
3130 returned if the domain is moving and :data:`wrf.ALL_TIMES` is selected as
3131 the *timeidx* parameter when using *wrfin*. Otherwise, a single
3132 :class:`wrf.GeoBounds` object is returned.
3133
3134 Args:
3135
3136 var (:class:`xarray.DataArray`, optional): A :class:`xarray.DataArray`
3137 variable that includes latitude,longitude coordinate information.
3138 If not used, then *wrfin* must be provided.
3139
3140 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
3141 iterable, optional): WRF-ARW NetCDF
3142 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
3143 or an iterable sequence of the aforementioned types. If not used,
3144 then *var* must be provided.
3145
3146 varname (:obj:`str`, optional): If using *wrfin*, then this will be the
3147 variable name to use to determine the geobounds. The variable
3148 can be a coordinate variable, or a regular variable that contains
3149 coordinate attributes. If None,
3150 then the 'XLAT', 'XLAT_M', 'XLONG', 'XLONG_M' variables
3151 will be used.
3152
3153 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The
3154 desired time index when *wrfin* is not None. This value can be a
3155 positive integer, negative integer, or
3156 :data:`wrf.ALL_TIMES` (an alias for None) to return
3157 all times in the file or sequence. Default is 0. This value is
3158 ignored when *var* is used.
3159
3160 method (:obj:`str`, optional): The aggregation method to use for
3161 sequences when *wrfin* is not None. Must be either 'cat' or
3162 'join'. 'cat' combines the data along the Time dimension.
3163 'join' creates a new dimension for the file index.
3164 The default is 'cat'.
3165
3166 squeeze (:obj:`bool`, optional): Set to False to prevent dimensions
3167 with a size of 1 from being automatically removed from the shape
3168 of the output. Only used when *wrfin* is used. Default is True.
3169
3170 cache (:obj:`dict`, optional): A dictionary of (varname, ndarray)
3171 that can be used to supply pre-extracted NetCDF variables to the
3172 computational routines. It is primarily used for internal
3173 purposes, but can also be used to improve performance by
3174 eliminating the need to repeatedly extract the same variables
3175 used in multiple diagnostics calculations, particularly when using

Callers 1

_get_wrf_proj_geobndsFunction · 0.85

Calls 11

xarray_enabledFunction · 0.85
_find_coord_namesFunction · 0.85
to_npFunction · 0.85
get_idFunction · 0.85
is_moving_domainFunction · 0.85
eitherClass · 0.85
extract_varsFunction · 0.85
_get_coord_namesFunction · 0.85
NullGeoBoundsClass · 0.85
iter_left_indexesFunction · 0.85
GeoBoundsClass · 0.85

Tested by

no test coverage detected