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

Function _get_proj_obj

src/wrf/util.py:3333–3419  ·  view source on GitHub ↗

Return the desired mapping object for the plotting type. Args: ob_type (:obj:`str`): Must be 'cartopy', 'basemap', or 'pyngl'. var (:class:`xarray.DataArray`): A :class:`xarray.DataArray` variable that includes latitude,longitude coordinate information.

(ob_type, var, wrfin, varname, timeidx, method, squeeze,
                  cache, **kwargs)

Source from the content-addressed store, hash-verified

3331
3332
3333def _get_proj_obj(ob_type, var, wrfin, varname, timeidx, method, squeeze,
3334 cache, **kwargs):
3335 """Return the desired mapping object for the plotting type.
3336
3337 Args:
3338
3339 ob_type (:obj:`str`): Must be 'cartopy', 'basemap', or 'pyngl'.
3340
3341 var (:class:`xarray.DataArray`): A :class:`xarray.DataArray`
3342 variable that includes latitude,longitude coordinate information.
3343 If not used, then *wrfin* must be provided.
3344
3345 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
3346 iterable): WRF-ARW NetCDF
3347 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
3348 or an iterable sequence of the aforementioned types. If not used,
3349 then *var* must be provided.
3350
3351 varname (:obj:`str`): If using *wrfin*, then this will be the
3352 variable name to use to determine the geobounds. The variable
3353 can be a coordinate variable, or a regular variable that contains
3354 coordinate attributes. If None,
3355 then the 'XLAT', 'XLAT_M', 'XLONG', 'XLONG_M' variables
3356 will be used.
3357
3358 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`): The
3359 desired time index. This value can be a positive integer,
3360 negative integer, or
3361 :data:`wrf.ALL_TIMES` (an alias for None) to return
3362 all times in the file or sequence. Default is 0.
3363
3364 method (:obj:`str`): The aggregation method to use for
3365 sequences. Must be either 'cat' or 'join'.
3366 'cat' combines the data along the Time dimension.
3367 'join' creates a new dimension for the file index.
3368 The default is 'cat'.
3369
3370 squeeze (:obj:`bool`): Set to False to prevent dimensions
3371 with a size of 1 from being automatically removed from the shape
3372 of the output. Default is True.
3373
3374 cache (:obj:`dict`): A dictionary of (varname, ndarray)
3375 that can be used to supply pre-extracted NetCDF variables to the
3376 computational routines. It is primarily used for internal
3377 purposes, but can also be used to improve performance by
3378 eliminating the need to repeatedly extract the same variables
3379 used in multiple diagnostics calculations, particularly when using
3380 large sequences of files.
3381 Default is None.
3382
3383 **kwargs: Additional keyword arguments for the plotting type.
3384
3385 Returns:
3386
3387 mapping object: Will be either :class:`cartopy.crs.Projection`,
3388 :class:`matplotlib.mpl_toolkits.basemap.Basemap` or
3389 :class:`Ngl.Resources`.
3390

Callers 3

get_cartopyFunction · 0.85
get_basemapFunction · 0.85
get_pynglFunction · 0.85

Calls 4

_get_wrf_proj_geobndsFunction · 0.85
cartopyMethod · 0.80
basemapMethod · 0.80
pynglMethod · 0.80

Tested by

no test coverage detected