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

Function _find_coord_names

src/wrf/util.py:1071–1100  ·  view source on GitHub ↗

Return the coordinate variables names found in a :attr:`xarray.DataArray.coords` mapping. Args: coords (mapping): A :attr:`xarray.DataArray.coords` mapping object. Returns: :obj:`tuple`: The latitude, longitude, and xtime variable names used in the coordinate

(coords)

Source from the content-addressed store, hash-verified

1069
1070
1071def _find_coord_names(coords):
1072 """Return the coordinate variables names found in a
1073 :attr:`xarray.DataArray.coords` mapping.
1074
1075 Args:
1076
1077 coords (mapping): A :attr:`xarray.DataArray.coords` mapping object.
1078
1079 Returns:
1080
1081 :obj:`tuple`: The latitude, longitude, and xtime variable names used
1082 in the coordinate mapping.
1083
1084 """
1085 try:
1086 lat_coord = [name for name in _COORD_VARS[0::2] if name in coords][0]
1087 except IndexError:
1088 lat_coord = None
1089
1090 try:
1091 lon_coord = [name for name in _COORD_VARS[1::2] if name in coords][0]
1092 except IndexError:
1093 lon_coord = None
1094
1095 try:
1096 xtime_coord = [name for name in _TIME_COORD_VARS if name in coords][0]
1097 except IndexError:
1098 xtime_coord = None
1099
1100 return lat_coord, lon_coord, xtime_coord
1101
1102
1103def _find_max_time_size(wrfseq):

Callers 4

_cat_filesFunction · 0.85
_join_filesFunction · 0.85
geo_boundsFunction · 0.85
latlon_coordsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected