From c7e394483234dbe3c574da0ca62208ee6bfc51f6 Mon Sep 17 00:00:00 2001 From: Bill Ladwig Date: Tue, 18 Dec 2018 17:08:06 -0700 Subject: [PATCH] Fixed typos. Adjusted metadata for individual products to reflect single product. --- src/wrf/g_cape.py | 48 ++++++++++++++++++++++++++++++++++++------ src/wrf/g_cloudfrac.py | 21 +++++++++++++++--- src/wrf/g_uvmet.py | 27 ++++++++++++++++++++---- src/wrf/g_wind.py | 28 ++++++++++++++++++++---- src/wrf/routines.py | 8 +++---- 5 files changed, 111 insertions(+), 21 deletions(-) diff --git a/src/wrf/g_cape.py b/src/wrf/g_cape.py index 7e33f45..062d28f 100755 --- a/src/wrf/g_cape.py +++ b/src/wrf/g_cape.py @@ -227,40 +227,76 @@ def get_3dcape(wrfin, timeidx=0, method="cat", def get_cape2d_only(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, missing=default_fill(np.float64)): - return get_2dcape(wrfin, timeidx, method, squeeze, cache, + result = get_2dcape(wrfin, timeidx, method, squeeze, cache, meta, _key, missing)[0,:] + + if meta: + result.attrs["description"] = "mcape" + result.attrs["units"] = "J kg-1" + + return result def get_cin2d_only(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, missing=default_fill(np.float64)): - return get_2dcape(wrfin, timeidx, method, squeeze, cache, + result = get_2dcape(wrfin, timeidx, method, squeeze, cache, meta, _key, missing)[1,:] + + if meta: + result.attrs["description"] = "mcin" + result.attrs["units"] = "J kg-1" + + return result def get_lcl(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, missing=default_fill(np.float64)): - return get_2dcape(wrfin, timeidx, method, squeeze, cache, + result = get_2dcape(wrfin, timeidx, method, squeeze, cache, meta, _key, missing)[2,:] + if meta: + result.attrs["description"] = "lcl" + result.attrs["units"] = "m" + + return result + def get_lfc(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, missing=default_fill(np.float64)): - return get_2dcape(wrfin, timeidx, method, squeeze, cache, + result = get_2dcape(wrfin, timeidx, method, squeeze, cache, meta, _key, missing)[3,:] + if meta: + result.attrs["description"] = "lfc" + result.attrs["units"] = "m" + + return result + def get_3dcape_only(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, missing=default_fill(np.float64)): - return get_3dcape(wrfin, timeidx, method, squeeze, cache, meta, + result = get_3dcape(wrfin, timeidx, method, squeeze, cache, meta, _key, missing)[0,:] + if meta: + result.attrs["description"] = "cape" + result.attrs["units"] = "J kg-1" + + return result + def get_3dcin_only(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, missing=default_fill(np.float64)): - return get_3dcape(wrfin, timeidx, method, squeeze, cache, meta, + result = get_3dcape(wrfin, timeidx, method, squeeze, cache, meta, _key, missing)[1,:] + + if meta: + result.attrs["description"] = "cin" + result.attrs["units"] = "J kg-1" + + return result \ No newline at end of file diff --git a/src/wrf/g_cloudfrac.py b/src/wrf/g_cloudfrac.py index 6ffcd37..a0458f6 100644 --- a/src/wrf/g_cloudfrac.py +++ b/src/wrf/g_cloudfrac.py @@ -166,27 +166,42 @@ def get_low_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, vert_type="height_agl", low_thresh=None, mid_thresh=None, high_thresh=None, missing=default_fill(np.float64)): - return get_cloudfrac(wrfin, timeidx, method, squeeze, + result = get_cloudfrac(wrfin, timeidx, method, squeeze, cache, meta, _key, vert_type, low_thresh, mid_thresh, high_thresh, missing)[0,:] + if meta: + result.attrs["description"] = "low clouds" + + return result + def get_mid_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, vert_type="height_agl", low_thresh=None, mid_thresh=None, high_thresh=None, missing=default_fill(np.float64)): - return get_cloudfrac(wrfin, timeidx, method, squeeze, + result = get_cloudfrac(wrfin, timeidx, method, squeeze, cache, meta, _key, vert_type, low_thresh, mid_thresh, high_thresh, missing)[1,:] + + if meta: + result.attrs["description"] = "mid clouds" + + return result def get_high_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, vert_type="height_agl", low_thresh=None, mid_thresh=None, high_thresh=None, missing=default_fill(np.float64)): - return get_cloudfrac(wrfin, timeidx, method, squeeze, + result = get_cloudfrac(wrfin, timeidx, method, squeeze, cache, meta, _key, vert_type, low_thresh, mid_thresh, high_thresh, missing)[2,:] + + if meta: + result.attrs["description"] = "high clouds" + + return result diff --git a/src/wrf/g_uvmet.py b/src/wrf/g_uvmet.py index 28d2165..9a058be 100755 --- a/src/wrf/g_uvmet.py +++ b/src/wrf/g_uvmet.py @@ -523,29 +523,48 @@ def get_uvmet10_wspd_wdir(wrfin, timeidx=0, method="cat", squeeze=True, def get_uvmet_wspd(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, units="m s-1"): - return get_uvmet_wspd_wdir(wrfin, timeidx, method, squeeze, + result = get_uvmet_wspd_wdir(wrfin, timeidx, method, squeeze, cache, meta, _key, units)[0,:] + if meta: + result.attrs["description"] = "earth rotated wspd" + + return result + def get_uvmet_wdir(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, units="m s-1"): - return get_uvmet_wspd_wdir(wrfin, timeidx, method, squeeze, + result = get_uvmet_wspd_wdir(wrfin, timeidx, method, squeeze, cache, meta, _key, units)[1,:] + if meta: + result.attrs["description"] = "earth rotated wdir" + + return result + def get_uvmet10_wspd(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, units="m s-1"): - return get_uvmet10_wspd_wdir(wrfin, timeidx, method, squeeze, + result = get_uvmet10_wspd_wdir(wrfin, timeidx, method, squeeze, cache, meta, _key, units)[0,:] + if meta: + result.attrs["description"] = "10m earth rotated wspd" + + return result def get_uvmet10_wdir(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, units="m s-1"): - return get_uvmet10_wspd_wdir(wrfin, timeidx, method, squeeze, + result = get_uvmet10_wspd_wdir(wrfin, timeidx, method, squeeze, cache, meta, _key, units)[1,:] + + if meta: + result.attrs["description"] = "10m earth rotated wdir" + + return result \ No newline at end of file diff --git a/src/wrf/g_wind.py b/src/wrf/g_wind.py index b4361c2..f91ead8 100755 --- a/src/wrf/g_wind.py +++ b/src/wrf/g_wind.py @@ -511,26 +511,46 @@ def get_destag_wspd_wdir10(wrfin, timeidx=0, method="cat", def get_destag_wspd(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, units="m s-1"): - return get_destag_wspd_wdir(wrfin, timeidx, method, squeeze, cache, + result = get_destag_wspd_wdir(wrfin, timeidx, method, squeeze, cache, meta, _key, units)[0,:] + if meta: + result.attrs["description"] = "wspd in projection space" + + return result + def get_destag_wdir(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, units="m s-1"): - return get_destag_wspd_wdir(wrfin, timeidx, method, squeeze, cache, + result = get_destag_wspd_wdir(wrfin, timeidx, method, squeeze, cache, meta, _key, units)[1,:] + + if meta: + result.attrs["description"] = "wdir in projection space" + + return result def get_destag_wspd10(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, units="m s-1"): - return get_destag_wspd_wdir10(wrfin, timeidx, method, + result = get_destag_wspd_wdir10(wrfin, timeidx, method, squeeze, cache, meta, _key, units)[0,:] + if meta: + result.attrs["description"] = "10m wspd in projection space" + + return result + def get_destag_wdir10(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, meta=True, _key=None, units="m s-1"): - return get_destag_wspd_wdir10(wrfin, timeidx, method, + result = get_destag_wspd_wdir10(wrfin, timeidx, method, squeeze, cache, meta, _key, units)[1,:] + + if meta: + result.attrs["description"] = "10m wdir in projection space" + + return result diff --git a/src/wrf/routines.py b/src/wrf/routines.py index 7d0644b..aef3697 100644 --- a/src/wrf/routines.py +++ b/src/wrf/routines.py @@ -92,9 +92,9 @@ _FUNC_MAP = {"cape2d" : get_2dcape, "wdir" : get_destag_wdir, "wspd10" : get_destag_wspd10, "wdir10" : get_destag_wdir10, - "low_cfrac" : get_low_cloudfrac, - "mid_cfrac" : get_mid_cloudfrac, - "high_cfrac" : get_high_cloudfrac + "low_cloudfrac" : get_low_cloudfrac, + "mid_cloudfrac" : get_mid_cloudfrac, + "high_cloudfrac" : get_high_cloudfrac } _VALID_KARGS = {"cape2d" : ["missing"], @@ -187,7 +187,7 @@ _ALIASES = {"cape_2d" : "cape2d", "th" : "theta", "low_cfrac" : "low_cloudfrac", "mid_cfrac" : "mid_cloudfrac", - "migh_cfrac" : "high_cloudfrac", + "high_cfrac" : "high_cloudfrac", "wspd_uvmet" : "uvmet_wspd" , "wdir_uvmet" : "uvmet_wdir" , "wspd_uvmet10" : "uvmet10_wspd" ,