From 379a7652bbe0f3890b3843ab3f9b1eafeb153f09 Mon Sep 17 00:00:00 2001 From: Bill Ladwig Date: Mon, 27 Mar 2017 14:29:10 -0600 Subject: [PATCH] Now ignores the XTIME coordinate variable if it is present in a variables coordinate list, but missing in the file. Fixes #11. --- doc/source/new.rst | 3 +++ src/wrf/util.py | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/source/new.rst b/doc/source/new.rst index c222dc4..905a3c3 100644 --- a/doc/source/new.rst +++ b/doc/source/new.rst @@ -10,6 +10,9 @@ v1.0.1 - Release 1.0.1 - Fixed issue with initialization of PolarStereographic and LatLon map projection objects. +- Fixed issue where XTIME could be included in the coordinate list of a + variable, but the actual XTIME variable could be missing. NCL allows this, + so wrf-python should as well. v1.0.0 diff --git a/src/wrf/util.py b/src/wrf/util.py index 9762604..d5985e5 100644 --- a/src/wrf/util.py +++ b/src/wrf/util.py @@ -1135,7 +1135,13 @@ def _get_coord_names(wrfin, varname): time_coord = coord_names[2] except IndexError: time_coord = None - + else: + # Make sure they time variable wasn't removed + try: + _ = wrfnc.variables[time_coord] + except KeyError: + time_coord = None + return lat_coord, lon_coord, time_coord