wrf.cartopy_ylim

wrf.cartopy_ylim(var=None, geobounds=None, wrfin=None, varname=None, timeidx=0, method='cat', squeeze=True, cache=None)

Return the y-axis limits in the projected coordinates.

For some map projections, like :class`wrf.RotatedLatLon`, the cartopy.GeoAxes.set_extent() method does not work correctly. This method is equivalent to:

pc = crs.PlateCarree()
xs, ys, _  = self._cartopy().transform_points(pc,
                     np.array([geobounds.bottom_left.lon,
                               geobounds.top_right.lon]),
                     np.array([geobounds.bottom_left.lat,
                               geobounds.top_right.lat])).T


_xlimits = xs.tolist()
_ylimits = ys.tolist()

return (_xlimits, _ylimits)[1]
Parameters:
  • var (xarray.DataArray, optional) – A xarray.DataArray variable that includes latitude,longitude coordinate information. If not used, then wrfin must be provided.

  • geobounds (wrf.GeoBounds, optional) – The geobounds to get the extents. If set to None and using the var parameter, the geobounds will be taken from the variable. If using a file, then the geobounds will be taken from the native grid.

  • wrfin (netCDF4.Dataset, Nio.NioFile, or an iterable, optional) – WRF-ARW NetCDF data as a netCDF4.Dataset, Nio.NioFile or 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 (int or wrf.ALL_TIMES, optional) – The desired time index. 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.

  • method (str, optional) – The aggregation method to use for sequences. 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. 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. Default is None.

Returns:

A list of [start_y, end_y] in the projected coordinate system.

Return type:

list