Browse Source

Changed default cfrac to use height_agl as the type. Since NCL never advertised this function, and it never really worked correctly before, breaking backwards compatibility is less of an issue.

lon0
Bill Ladwig 7 years ago
parent
commit
1cc072b2a9
  1. 98
      doc/source/_templates/product_table.txt
  2. 20
      src/wrf/g_cloudfrac.py
  3. 13
      test/utests.py

98
doc/source/_templates/product_table.txt

@ -1,44 +1,50 @@
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| Variable Name | Description | Available Units | Additional Keyword Arguments | | Variable Name | Description | Available Units | Additional Keyword Arguments |
+====================+===============================================================+=============================+===============================================================================================+ +====================+===============================================================+=============================+=========================================================================================================================================================+
| avo | Absolute Vorticity | 10-5 s-1 | | | avo | Absolute Vorticity | 10-5 s-1 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| eth/theta_e | Equivalent Potential Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | | eth/theta_e | Equivalent Potential Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. |
| | | | | | | | | |
| | | degC | | | | | degC | |
| | | | | | | | | |
| | | degF | | | | | degF | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| cape_2d | 2D cape (mcape/mcin/lcl/lfc) | J kg-1 ; J kg-1 ; m ; m | **missing** (float): Fill value for output only | | cape_2d | 2D cape (mcape/mcin/lcl/lfc) | J kg-1 ; J kg-1 ; m ; m | **missing** (float): Fill value for output only |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| cape_3d | 3D cape and cin | J kg-1 | **missing** (float): Fill value for output only | | cape_3d | 3D cape and cin | J kg-1 | **missing** (float): Fill value for output only |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| ctt | Cloud Top Temperature | degC | **units** (str) : Set to desired units. Default is *'degC'*. | | ctt | Cloud Top Temperature | degC | **units** (str) : Set to desired units. Default is *'degC'*. |
| | | | | | | | | |
| | | K | | | | | K | |
| | | | | | | | | |
| | | degF | | | | | degF | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| cloudfrac | Cloud Fraction | % | | | cloudfrac | Cloud Fraction | % | **vert_type** (str): The vertical coordinate type for the cloud thresholds. Must be 'height_agl', 'height_msl', or 'pres'. Default is 'height_agl'. |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ | | | | |
| | | | **low_thresh** (float): The low cloud threshold (meters for 'height_agl' and 'height_msl', pascals for 'pres'). Default is 300 m (97000 Pa) |
| | | | |
| | | | **mid_thresh** (float): The mid cloud threshold (meters for 'height_agl' and 'height_msl', pascals for 'pres'). Default is 2000 m (80000 Pa) |
| | | | |
| | | | **high_thresh** (float): The high cloud threshold (meters for 'height_agl' and 'height_msl', pascals for 'pres'). Default is 6000 m (45000 Pa) |
+--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| dbz | Reflectivity | dBZ | **do_variant** (boolean): Set to True to enable variant calculation. Default is *False*. | | dbz | Reflectivity | dBZ | **do_variant** (boolean): Set to True to enable variant calculation. Default is *False*. |
| | | | | | | | | |
| | | | **do_liqskin** (boolean): Set to True to enable liquid skin calculation. Default is *False*. | | | | | **do_liqskin** (boolean): Set to True to enable liquid skin calculation. Default is *False*. |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| mdbz | Maximum Reflectivity | dBZ | **do_variant** (boolean): Set to True to enable variant calculation. Default is *False*. | | mdbz | Maximum Reflectivity | dBZ | **do_variant** (boolean): Set to True to enable variant calculation. Default is *False*. |
| | | | | | | | | |
| | | | **do_liqskin** (boolean): Set to True to enable liquid skin calculation. Default is *False*. | | | | | **do_liqskin** (boolean): Set to True to enable liquid skin calculation. Default is *False*. |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| geopt/geopotential | Full Model Geopotential | m2 s-2 | | | geopt/geopotential | Full Model Geopotential | m2 s-2 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| helicity | Storm Relative Helicity | m2 s-2 | **top** (float): The top level for the calculation in meters. Default is *3000.0*. | | helicity | Storm Relative Helicity | m2 s-2 | **top** (float): The top level for the calculation in meters. Default is *3000.0*. |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| lat | Latitude | decimal degrees | | | lat | Latitude | decimal degrees | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| lon | Longitude | decimal degrees | | | lon | Longitude | decimal degrees | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| omg/omega | Omega | Pa s-1 | | | omg/omega | Omega | Pa s-1 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| p/pres | Full Model Pressure | Pa | **units** (str) : Set to desired units. Default is *'Pa'*. | | p/pres | Full Model Pressure | Pa | **units** (str) : Set to desired units. Default is *'Pa'*. |
| | | | | | | | | |
| | (in specified units) | hPa | | | | (in specified units) | hPa | |
@ -50,17 +56,17 @@
| | | mmhg | | | | | mmhg | |
| | | | | | | | | |
| | | atm | | | | | atm | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| pressure | Full Model Pressure (hPa) | hPa | | | pressure | Full Model Pressure (hPa) | hPa | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| pvo | Potential Vorticity | PVU | | | pvo | Potential Vorticity | PVU | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| pw | Precipitable Water | kg m-2 | | | pw | Precipitable Water | kg m-2 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| rh | Relative Humidity | % | | | rh | Relative Humidity | % | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| rh2 | 2m Relative Humidity | % | | | rh2 | 2m Relative Humidity | % | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| slp | Sea Level Pressure | hPa | **units** (str) : Set to desired units. Default is *'hPa'*. | | slp | Sea Level Pressure | hPa | **units** (str) : Set to desired units. Default is *'hPa'*. |
| | | | | | | | | |
| | | hPa | | | | | hPa | |
@ -72,7 +78,7 @@
| | | mmhg | | | | | mmhg | |
| | | | | | | | | |
| | | atm | | | | | atm | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| ter | Model Terrain Height | m | **units** (str) : Set to desired units. Default is *'m'*. | | ter | Model Terrain Height | m | **units** (str) : Set to desired units. Default is *'m'*. |
| | | | | | | | | |
| | | km | | | | | km | |
@ -82,59 +88,59 @@
| | | ft | | | | | ft | |
| | | | | | | | | |
| | | mi | | | | | mi | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| td2 | 2m Dew Point Temperature | degC | **units** (str) : Set to desired units. Default is *'degC'*. | | td2 | 2m Dew Point Temperature | degC | **units** (str) : Set to desired units. Default is *'degC'*. |
| | | | | | | | | |
| | | K | | | | | K | |
| | | | | | | | | |
| | | degF | | | | | degF | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| td | Dew Point Temperature | degC | **units** (str) : Set to desired units. Default is *'degC'*. | | td | Dew Point Temperature | degC | **units** (str) : Set to desired units. Default is *'degC'*. |
| | | | | | | | | |
| | | K | | | | | K | |
| | | | | | | | | |
| | | degF | | | | | degF | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| tc | Temperature in Celsius | degC | | | tc | Temperature in Celsius | degC | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| th/theta | Potential Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | | th/theta | Potential Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. |
| | | | | | | | | |
| | | degC | | | | | degC | |
| | | | | | | | | |
| | | degF | | | | | degF | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| temp | Temperature (in specified units) | K | **units** (str) : Set to desired units. Default is *'K'*. | | temp | Temperature (in specified units) | K | **units** (str) : Set to desired units. Default is *'K'*. |
| | | | | | | | | |
| | | degC | | | | | degC | |
| | | | | | | | | |
| | | degF | | | | | degF | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| tk | Temperature in Kelvin | K | | | tk | Temperature in Kelvin | K | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| times | Times in the File or Sequence | | | | times | Times in the File or Sequence | | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| xtimes | XTIME Coordinate | minutes since | | | xtimes | XTIME Coordinate | minutes since | |
| | | | | | | | | |
| | (if applicable) | start of | | | | (if applicable) | start of | |
| | | | | | | | | |
| | | model run | | | | | model run | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| tv | Virtual Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | | tv | Virtual Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. |
| | | | | | | | | |
| | | degC | | | | | degC | |
| | | | | | | | | |
| | | degF | | | | | degF | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| twb | Wet Bulb Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | | twb | Wet Bulb Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. |
| | | | | | | | | |
| | | degC | | | | | degC | |
| | | | | | | | | |
| | | degF | | | | | degF | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| updraft_helicity | Updraft Helicity | m2 s-2 | **bottom** (float): The bottom level for the calculation in meters. Default is *2000.0*. | | updraft_helicity | Updraft Helicity | m2 s-2 | **bottom** (float): The bottom level for the calculation in meters. Default is *2000.0*. |
| | | | | | | | | |
| | | | **top** (float): The top level for the calculation in meters. Default is *5000.0*. | | | | | **top** (float): The top level for the calculation in meters. Default is *5000.0*. |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| ua | U-component of Wind on Mass Points | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. | | ua | U-component of Wind on Mass Points | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. |
| | | | | | | | | |
| | | km h-1 | | | | | km h-1 | |
@ -144,7 +150,7 @@
| | | kt | | | | | kt | |
| | | | | | | | | |
| | | ft s-1 | | | | | ft s-1 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| va | V-component of Wind on Mass Points | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. | | va | V-component of Wind on Mass Points | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. |
| | | | | | | | | |
| | | km h-1 | | | | | km h-1 | |
@ -154,7 +160,7 @@
| | | kt | | | | | kt | |
| | | | | | | | | |
| | | ft s-1 | | | | | ft s-1 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| wa | W-component of Wind on Mass Points | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. | | wa | W-component of Wind on Mass Points | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. |
| | | | | | | | | |
| | | km h-1 | | | | | km h-1 | |
@ -164,7 +170,7 @@
| | | kt | | | | | kt | |
| | | | | | | | | |
| | | ft s-1 | | | | | ft s-1 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| uvmet10 | 10 m U and V Components of Wind | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. | | uvmet10 | 10 m U and V Components of Wind | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. |
| | | | | | | | | |
| | Rotated to Earth Coordinates | km h-1 | | | | Rotated to Earth Coordinates | km h-1 | |
@ -174,7 +180,7 @@
| | | kt | | | | | kt | |
| | | | | | | | | |
| | | ft s-1 | | | | | ft s-1 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| uvmet | U and V Components of Wind | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. | | uvmet | U and V Components of Wind | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. |
| | | | | | | | | |
| | Rotated to Earth Coordinates | km h-1 | | | | Rotated to Earth Coordinates | km h-1 | |
@ -184,7 +190,7 @@
| | | kt | | | | | kt | |
| | | | | | | | | |
| | | ft s-1 | | | | | ft s-1 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| wspd_wdir | Wind Speed and Direction (wind_from_direction) | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. | | wspd_wdir | Wind Speed and Direction (wind_from_direction) | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. |
| | | | | | | | | |
| | in Grid Coordinates | km h-1 | | | | in Grid Coordinates | km h-1 | |
@ -194,7 +200,7 @@
| | | kt | | | | | kt | |
| | | | | | | | | |
| | | ft s-1 | | | | | ft s-1 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| wspd_wdir10 | 10m Wind Speed and Direction (wind_from_direction) | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. | | wspd_wdir10 | 10m Wind Speed and Direction (wind_from_direction) | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. |
| | | | | | | | | |
| | in Grid Coordinates | km h-1 | | | | in Grid Coordinates | km h-1 | |
@ -204,7 +210,7 @@
| | | kt | | | | | kt | |
| | | | | | | | | |
| | | ft s-1 | | | | | ft s-1 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| uvmet_wspd_wdir | Wind Speed and Direction (wind_from_direction) | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. | | uvmet_wspd_wdir | Wind Speed and Direction (wind_from_direction) | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. |
| | | | | | | | | |
| | Rotated to Earth Coordinates | km h-1 | | | | Rotated to Earth Coordinates | km h-1 | |
@ -214,7 +220,7 @@
| | | kt | | | | | kt | |
| | | | | | | | | |
| | | ft s-1 | | | | | ft s-1 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| uvmet10_wspd_wdir | 10m Wind Speed and Direction (wind_from_direction) | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. | | uvmet10_wspd_wdir | 10m Wind Speed and Direction (wind_from_direction) | m s-1 | **units** (str) : Set to desired units. Default is *'m s-1'*. |
| | | | | | | | | |
| | Rotated to Earth Coordinates | km h-1 | | | | Rotated to Earth Coordinates | km h-1 | |
@ -224,7 +230,7 @@
| | | kt | | | | | kt | |
| | | | | | | | | |
| | | ft s-1 | | | | | ft s-1 | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| z/height | Full Model Height on Mass Levels | m | **msl** (boolean): Set to False to return AGL values. True is for MSL. Default is *True*. | | z/height | Full Model Height on Mass Levels | m | **msl** (boolean): Set to False to return AGL values. True is for MSL. Default is *True*. |
| | | | | | | | | |
| | | km | **units** (str) : Set to desired units. Default is *'m'*. | | | | km | **units** (str) : Set to desired units. Default is *'m'*. |
@ -234,7 +240,5 @@
| | | ft | | | | | ft | |
| | | | | | | | | |
| | | mi | | | | | mi | |
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ +--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+

20
src/wrf/g_cloudfrac.py

@ -14,7 +14,7 @@ from .g_geoht import _get_geoht
@set_cloudfrac_metadata() @set_cloudfrac_metadata()
def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True, def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True,
cache=None, meta=True, _key=None, cache=None, meta=True, _key=None,
vert_type="pres", low_thresh=None, mid_thresh=None, vert_type="height_agl", low_thresh=None, mid_thresh=None,
high_thresh=None, missing=default_fill(np.float64)): high_thresh=None, missing=default_fill(np.float64)):
"""Return the cloud fraction for low, mid, and high level clouds. """Return the cloud fraction for low, mid, and high level clouds.
@ -25,13 +25,6 @@ def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True,
- return_val[1,...] will contain MID level cloud fraction - return_val[1,...] will contain MID level cloud fraction
- return_val[2,...] will contain HIGH level cloud fraction - return_val[2,...] will contain HIGH level cloud fraction
For backwards compatibility, the default vertical coordinate type is
pressure, with default cloud levels defined as:
97000 Pa <= low_cloud < 80000 Pa
80000 Pa <= mid_cloud < 45000 Pa
45000 Pa <= high_cloud
If the vertical coordinate type is 'height_agl' or 'height_msl', the If the vertical coordinate type is 'height_agl' or 'height_msl', the
default cloud levels are defined as: default cloud levels are defined as:
@ -39,6 +32,12 @@ def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True,
2000 m <= mid_cloud < 6000 m 2000 m <= mid_cloud < 6000 m
6000 m <= high_cloud 6000 m <= high_cloud
For 'pres', the default cloud levels are defined as:
97000 Pa <= low_cloud < 80000 Pa
80000 Pa <= mid_cloud < 45000 Pa
45000 Pa <= high_cloud
Note that the default low cloud levels are chosen to Note that the default low cloud levels are chosen to
exclude clouds near the surface (fog). If you want fog included, set exclude clouds near the surface (fog). If you want fog included, set
*low_thresh* to ~99500 Pa if *vert_type* is set to 'pres', or 15 m if using *low_thresh* to ~99500 Pa if *vert_type* is set to 'pres', or 15 m if using
@ -95,9 +94,8 @@ def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True,
purposes only. Default is None. purposes only. Default is None.
vert_type (:obj:`str`, optional): The type of vertical coordinate used vert_type (:obj:`str`, optional): The type of vertical coordinate used
to determine cloud type thresholds. Must be 'pres', 'height_msl', to determine cloud type thresholds. Must be 'height_agl',
or 'height_agl'. For backwards compatibility, the default 'height_msl', or 'pres'. The default is 'height_agl'.
is 'pres'.
low_thresh (:obj:`float`, optional): The lower bound for what is low_thresh (:obj:`float`, optional): The lower bound for what is
considered a low cloud. If *vert_type* is 'pres', the default is considered a low cloud. If *vert_type* is 'pres', the default is

13
test/utests.py

@ -138,6 +138,13 @@ def make_test(varname, wrf_in, referent, multi=False, repeat=3, pynio=False):
tol = 1/100. tol = 1/100.
atol = .1 # Note: NCL uses 273.16 as conversion for some reason atol = .1 # Note: NCL uses 273.16 as conversion for some reason
nt.assert_allclose(to_np(my_vals), ref_vals, tol, atol) nt.assert_allclose(to_np(my_vals), ref_vals, tol, atol)
elif (varname == "cfrac"):
# Change the vert_type to height_agl when NCL gets updated.
my_vals = getvar(in_wrfnc, "cfrac", timeidx=timeidx,
vert_type="pres")
tol = 1/100.
atol = .1 # Note: NCL uses 273.16 as conversion for some reason
nt.assert_allclose(to_np(my_vals), ref_vals, tol, atol)
elif (varname == "pw"): elif (varname == "pw"):
my_vals = getvar(in_wrfnc, "pw", timeidx=timeidx) my_vals = getvar(in_wrfnc, "pw", timeidx=timeidx)
tol = .5/100.0 tol = .5/100.0
@ -611,6 +618,12 @@ class WRFLatLonTest(ut.TestCase):
if __name__ == "__main__": if __name__ == "__main__":
from wrf import (omp_set_num_threads, omp_set_schedule, omp_get_schedule,
omp_set_dynamic, Constants)
omp_set_num_threads(6)
omp_set_schedule(Constants.OMP_SCHED_STATIC, 0)
omp_set_dynamic(False)
ignore_vars = [] # Not testable yet ignore_vars = [] # Not testable yet
wrf_vars = ["avo", "eth", "cape_2d", "cape_3d", "ctt", "dbz", "mdbz", wrf_vars = ["avo", "eth", "cape_2d", "cape_3d", "ctt", "dbz", "mdbz",
"geopt", "helicity", "lat", "lon", "omg", "p", "pressure", "geopt", "helicity", "lat", "lon", "omg", "p", "pressure",

Loading…
Cancel
Save