wrf.xy_to_ll

wrf.xy_to_ll(wrfin, x, y, timeidx=0, squeeze=True, meta=True, stagger=None)

Return the latitude and longitude for specified x,y coordinates.

The x and y arguments can be a single value or a sequence of values.

The leftmost dimension of the returned array represents two different quantities:

  • return_val[0,…] will contain the latitude values.
  • return_val[1,…] will contain the longitude values.
Parameters:
  • wrfin (netCDF4.Dataset, Nio.NioFile, or an iterable) – WRF-ARW NetCDF data as a netCDF4.Dataset, Nio.NioFile or an iterable sequence of the aforementioned types.
  • x (float or sequence) – A single x-coordinate or a sequence of x-coordinate values to be converted.
  • y (float or sequence) – A single y-coordinate or a sequence of y-coordinate values to be converted.
  • 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. The default is 0.
  • 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.
  • meta (bool, optional) – Set to False to disable metadata and return numpy.ndarray instead of xarray.DataArray. Default is True.
  • stagger (str) –

    By default, the latitude is returned on the mass grid, but a staggered grid can be chosen with the following options:

    • ’m’: Use the mass grid (default).
    • ’u’: Use the same staggered grid as the u wind component, which has a staggered west_east (x) dimension.
    • ’v’: Use the same staggered grid as the v wind component, which has a staggered south_north (y) dimension.
Returns:

The latitude and longitude values whose leftmost dimension is 2 (0=latitude, 1=longitude). If xarray is enabled and the meta parameter is True, then the result will be a xarray.DataArray object. Otherwise, the result will be a numpy.ndarray object with no metadata.

Return type:

xarray.DataArray or numpy.ndarray