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

Function ll_points

src/wrf/util.py:3857–3888  ·  view source on GitHub ↗

Return the lower left latitude and longitude point(s). This functions extracts the lower left corner points and returns the result as either a single :class:`CoordPair` object, or a list of :class:`CoordPair` objects. This is primarily used for testing or constructing the corner po

(lat, lon)

Source from the content-addressed store, hash-verified

3855
3856
3857def ll_points(lat, lon):
3858 """Return the lower left latitude and longitude point(s).
3859
3860 This functions extracts the lower left corner points and returns the result
3861 as either a single :class:`CoordPair` object, or a list of
3862 :class:`CoordPair` objects.
3863
3864 This is primarily used for testing or constructing the corner point objects
3865 from the XLAT and XLONG variables.
3866
3867 Args:
3868
3869 lat (:class:`xarray.DataArray` or :class:`numpy.ndarray`): The latitude
3870 array. Must be at least two dimensions.
3871
3872 lon (:class:`xarray.DataArray` or :class:`numpy.ndarray`): The
3873 longitude array. Must be at least two dimensions.
3874
3875 Returns:
3876
3877 :class:`wrf.CoordPair` or :obj:`list`: A single :class:`wrf.CoordPair`
3878 object or a list of :class:`wrf.CoordPair` objects.
3879
3880 """
3881 latvals = np.ravel(to_np(lat)[..., 0, 0])
3882 lonvals = np.ravel(to_np(lon)[..., 0, 0])
3883
3884 if latvals.shape[0] == 1:
3885 return CoordPair(lat=float(latvals), lon=float(lonvals))
3886 else:
3887 return [CoordPair(lat=latvals[i], lon=lonvals[i])
3888 for i in py3range(latvals.shape[0])]
3889
3890
3891def pairs_to_latlon(pairs):

Callers 1

testFunction · 0.90

Calls 3

to_npFunction · 0.85
CoordPairClass · 0.85
py3rangeFunction · 0.85

Tested by 1

testFunction · 0.72