Return the first found latitude and longitude coordinate names from a NetCDF variable dictionary. This function searches the dictionary structure for NetCDF variables and returns the first found latitude and longitude coordinate names (typically 'XLAT' and 'XLONG'). Args:
(ncvars)
| 273 | |
| 274 | |
| 275 | def latlon_coordvars(ncvars): |
| 276 | """Return the first found latitude and longitude coordinate names from a |
| 277 | NetCDF variable dictionary. |
| 278 | |
| 279 | This function searches the dictionary structure for NetCDF variables |
| 280 | and returns the first found latitude and longitude coordinate |
| 281 | names (typically 'XLAT' and 'XLONG'). |
| 282 | |
| 283 | Args: |
| 284 | |
| 285 | ncvars (:obj:`dict`): A NetCDF variable dictionary object. |
| 286 | |
| 287 | Returns: |
| 288 | |
| 289 | :obj:`tuple`: The latitude and longitude coordinate name pairs as |
| 290 | (lat_coord_name, lon_coord_name). |
| 291 | |
| 292 | """ |
| 293 | lat_coord = None |
| 294 | lon_coord = None |
| 295 | |
| 296 | for name in _LAT_COORDS: |
| 297 | if name in viewkeys(ncvars): |
| 298 | lat_coord = name |
| 299 | break |
| 300 | |
| 301 | for name in _LON_COORDS: |
| 302 | if name in viewkeys(ncvars): |
| 303 | lon_coord = name |
| 304 | break |
| 305 | |
| 306 | return lat_coord, lon_coord |
| 307 | |
| 308 | |
| 309 | def is_coordvar(varname): |
no test coverage detected