geo_bounds(var=None, wrfin=None, varname=None, timeidx=0, method='cat', squeeze=True, cache=None)¶
Return the geographic boundaries for the variable or file(s).
When using a
xarray.DataArrayas the var parameter, the variable must contain latitude and longitude coordinates. If these coordinate dimensions are greater than two dimensions, then an array of
wrf.GeoBoundsobjects will be returned with the same shape as the leftmost dimensions of the coordinate arrays.
When using a WRF file, or sequence of WRF files, by supplying the wrfin parameter, an array of
wrf.GeoBoundsobjects will be returned if the domain is moving and
wrf.ALL_TIMESis selected as the timeidx parameter when using wrfin. Otherwise, a single
wrf.GeoBoundsobject is returned.
- var (
xarray.DataArray, optional) – A
xarray.DataArrayvariable that includes latitude,longitude coordinate information. If not used, then wrfin must be provided.
- wrfin (
Nio.NioFile, or an iterable, optional) – WRF-ARW NetCDF data as a
Nio.NioFileor an iterable sequence of the aforementioned types. If not used, then var must be provided.
- varname (
str, optional) – If using wrfin, then this will be the variable name to use to determine the geobounds. The variable can be a coordinate variable, or a regular variable that contains coordinate attributes. If None, then the ‘XLAT’, ‘XLAT_M’, ‘XLONG’, ‘XLONG_M’ variables will be used.
- timeidx (
wrf.ALL_TIMES, optional) – The desired time index when wrfin is not None. This value can be a positive integer, negative integer, or
wrf.ALL_TIMES(an alias for None) to return all times in the file or sequence. Default is 0. This value is ignored when var is used.
- method (
str, optional) – The aggregation method to use for sequences when wrfin is not None. Must be either ‘cat’ or ‘join’. ‘cat’ combines the data along the Time dimension. ‘join’ creates a new dimension for the file index. The default is ‘cat’.
- squeeze (
bool, optional) – Set to False to prevent dimensions with a size of 1 from being automatically removed from the shape of the output. Only used when wrfin is used. Default is True.
- cache (
dict, optional) – A dictionary of (varname, ndarray) that can be used to supply pre-extracted NetCDF variables to the computational routines. It is primarily used for internal purposes, but can also be used to improve performance by eliminating the need to repeatedly extract the same variables used in multiple diagnostics calculations, particularly when using large sequences of files. Only used when wrfin is used. Default is None.
The domain geographic bounds.
- var (