From 1cc072b2a9b87734eed43f6ea08084bfbcde8fd6 Mon Sep 17 00:00:00 2001 From: Bill Ladwig Date: Mon, 18 Dec 2017 16:38:58 -0700 Subject: [PATCH] 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. --- doc/source/_templates/product_table.txt | 482 ++++++++++++------------ src/wrf/g_cloudfrac.py | 20 +- test/utests.py | 13 + 3 files changed, 265 insertions(+), 250 deletions(-) diff --git a/doc/source/_templates/product_table.txt b/doc/source/_templates/product_table.txt index 8e92724..8dfb388 100644 --- a/doc/source/_templates/product_table.txt +++ b/doc/source/_templates/product_table.txt @@ -1,240 +1,244 @@ -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| Variable Name | Description | Available Units | Additional Keyword Arguments | -+====================+===============================================================+=============================+===============================================================================================+ -| avo | Absolute Vorticity | 10-5 s-1 | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| eth/theta_e | Equivalent Potential Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | -| | | | | -| | | degC | | -| | | | | -| | | 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_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'*. | -| | | | | -| | | K | | -| | | | | -| | | degF | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| cloudfrac | Cloud Fraction | % | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| 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*. | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| 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*. | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| 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*. | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| lat | Latitude | decimal degrees | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| lon | Longitude | decimal degrees | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| omg/omega | Omega | Pa s-1 | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| p/pres | Full Model Pressure | Pa | **units** (str) : Set to desired units. Default is *'Pa'*. | -| | | | | -| | (in specified units) | hPa | | -| | | | | -| | | mb | | -| | | | | -| | | torr | | -| | | | | -| | | mmhg | | -| | | | | -| | | atm | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| pressure | Full Model Pressure (hPa) | hPa | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| pvo | Potential Vorticity | PVU | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| pw | Precipitable Water | kg m-2 | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| rh | Relative Humidity | % | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| rh2 | 2m Relative Humidity | % | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| slp | Sea Level Pressure | hPa | **units** (str) : Set to desired units. Default is *'hPa'*. | -| | | | | -| | | hPa | | -| | | | | -| | | mb | | -| | | | | -| | | torr | | -| | | | | -| | | mmhg | | -| | | | | -| | | atm | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| ter | Model Terrain Height | m | **units** (str) : Set to desired units. Default is *'m'*. | -| | | | | -| | | km | | -| | | | | -| | | dm | | -| | | | | -| | | ft | | -| | | | | -| | | mi | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| td2 | 2m Dew Point Temperature | degC | **units** (str) : Set to desired units. Default is *'degC'*. | -| | | | | -| | | K | | -| | | | | -| | | degF | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| td | Dew Point Temperature | degC | **units** (str) : Set to desired units. Default is *'degC'*. | -| | | | | -| | | K | | -| | | | | -| | | degF | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| tc | Temperature in Celsius | degC | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| th/theta | Potential Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | -| | | | | -| | | degC | | -| | | | | -| | | degF | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| temp | Temperature (in specified units) | K | **units** (str) : Set to desired units. Default is *'K'*. | -| | | | | -| | | degC | | -| | | | | -| | | degF | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| tk | Temperature in Kelvin | K | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| times | Times in the File or Sequence | | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| xtimes | XTIME Coordinate | minutes since | | -| | | | | -| | (if applicable) | start of | | -| | | | | -| | | model run | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| tv | Virtual Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | -| | | | | -| | | degC | | -| | | | | -| | | degF | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| twb | Wet Bulb Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | -| | | | | -| | | degC | | -| | | | | -| | | degF | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| 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*. | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ -| 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 | | -| | | | | -| | | mi h-1 | | -| | | | | -| | | kt | | -| | | | | -| | | 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'*. | -| | | | | -| | | km h-1 | | -| | | | | -| | | mi h-1 | | -| | | | | -| | | kt | | -| | | | | -| | | 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'*. | -| | | | | -| | | km h-1 | | -| | | | | -| | | mi h-1 | | -| | | | | -| | | kt | | -| | | | | -| | | 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'*. | -| | | | | -| | Rotated to Earth Coordinates | km h-1 | | -| | | | | -| | | mi h-1 | | -| | | | | -| | | kt | | -| | | | | -| | | ft 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 | | -| | | | | -| | | mi h-1 | | -| | | | | -| | | kt | | -| | | | | -| | | 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'*. | -| | | | | -| | in Grid Coordinates | km h-1 | | -| | | | | -| | | mi h-1 | | -| | | | | -| | | kt | | -| | | | | -| | | 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'*. | -| | | | | -| | in Grid Coordinates | km h-1 | | -| | | | | -| | | mi h-1 | | -| | | | | -| | | kt | | -| | | | | -| | | 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'*. | -| | | | | -| | Rotated to Earth Coordinates | km h-1 | | -| | | | | -| | | mi h-1 | | -| | | | | -| | | kt | | -| | | | | -| | | 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'*. | -| | | | | -| | Rotated to Earth Coordinates | km h-1 | | -| | | | | -| | | mi h-1 | | -| | | | | -| | | kt | | -| | | | | -| | | 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*. | -| | | | | -| | | km | **units** (str) : Set to desired units. Default is *'m'*. | -| | | | | -| | | dm | | -| | | | | -| | | ft | | -| | | | | -| | | mi | | -+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ - - ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Variable Name | Description | Available Units | Additional Keyword Arguments | ++====================+===============================================================+=============================+=========================================================================================================================================================+ +| avo | Absolute Vorticity | 10-5 s-1 | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| eth/theta_e | Equivalent Potential Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | +| | | | | +| | | degC | | +| | | | | +| | | 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_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'*. | +| | | | | +| | | K | | +| | | | | +| | | degF | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| 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*. | +| | | | | +| | | | **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*. | +| | | | | +| | | | **do_liqskin** (boolean): Set to True to enable liquid skin calculation. Default is *False*. | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| 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*. | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| lat | Latitude | decimal degrees | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| lon | Longitude | decimal degrees | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| omg/omega | Omega | Pa s-1 | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| p/pres | Full Model Pressure | Pa | **units** (str) : Set to desired units. Default is *'Pa'*. | +| | | | | +| | (in specified units) | hPa | | +| | | | | +| | | mb | | +| | | | | +| | | torr | | +| | | | | +| | | mmhg | | +| | | | | +| | | atm | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| pressure | Full Model Pressure (hPa) | hPa | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| pvo | Potential Vorticity | PVU | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| pw | Precipitable Water | kg m-2 | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| rh | Relative Humidity | % | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| rh2 | 2m Relative Humidity | % | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| slp | Sea Level Pressure | hPa | **units** (str) : Set to desired units. Default is *'hPa'*. | +| | | | | +| | | hPa | | +| | | | | +| | | mb | | +| | | | | +| | | torr | | +| | | | | +| | | mmhg | | +| | | | | +| | | atm | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ter | Model Terrain Height | m | **units** (str) : Set to desired units. Default is *'m'*. | +| | | | | +| | | km | | +| | | | | +| | | dm | | +| | | | | +| | | ft | | +| | | | | +| | | mi | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| td2 | 2m Dew Point Temperature | degC | **units** (str) : Set to desired units. Default is *'degC'*. | +| | | | | +| | | K | | +| | | | | +| | | degF | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| td | Dew Point Temperature | degC | **units** (str) : Set to desired units. Default is *'degC'*. | +| | | | | +| | | K | | +| | | | | +| | | degF | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| tc | Temperature in Celsius | degC | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| th/theta | Potential Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | +| | | | | +| | | degC | | +| | | | | +| | | degF | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| temp | Temperature (in specified units) | K | **units** (str) : Set to desired units. Default is *'K'*. | +| | | | | +| | | degC | | +| | | | | +| | | degF | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| tk | Temperature in Kelvin | K | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| times | Times in the File or Sequence | | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| xtimes | XTIME Coordinate | minutes since | | +| | | | | +| | (if applicable) | start of | | +| | | | | +| | | model run | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| tv | Virtual Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | +| | | | | +| | | degC | | +| | | | | +| | | degF | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| twb | Wet Bulb Temperature | K | **units** (str) : Set to desired units. Default is *'K'*. | +| | | | | +| | | degC | | +| | | | | +| | | degF | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| 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*. | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| 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 | | +| | | | | +| | | mi h-1 | | +| | | | | +| | | kt | | +| | | | | +| | | 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'*. | +| | | | | +| | | km h-1 | | +| | | | | +| | | mi h-1 | | +| | | | | +| | | kt | | +| | | | | +| | | 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'*. | +| | | | | +| | | km h-1 | | +| | | | | +| | | mi h-1 | | +| | | | | +| | | kt | | +| | | | | +| | | 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'*. | +| | | | | +| | Rotated to Earth Coordinates | km h-1 | | +| | | | | +| | | mi h-1 | | +| | | | | +| | | kt | | +| | | | | +| | | ft 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 | | +| | | | | +| | | mi h-1 | | +| | | | | +| | | kt | | +| | | | | +| | | 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'*. | +| | | | | +| | in Grid Coordinates | km h-1 | | +| | | | | +| | | mi h-1 | | +| | | | | +| | | kt | | +| | | | | +| | | 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'*. | +| | | | | +| | in Grid Coordinates | km h-1 | | +| | | | | +| | | mi h-1 | | +| | | | | +| | | kt | | +| | | | | +| | | 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'*. | +| | | | | +| | Rotated to Earth Coordinates | km h-1 | | +| | | | | +| | | mi h-1 | | +| | | | | +| | | kt | | +| | | | | +| | | 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'*. | +| | | | | +| | Rotated to Earth Coordinates | km h-1 | | +| | | | | +| | | mi h-1 | | +| | | | | +| | | kt | | +| | | | | +| | | 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*. | +| | | | | +| | | km | **units** (str) : Set to desired units. Default is *'m'*. | +| | | | | +| | | dm | | +| | | | | +| | | ft | | +| | | | | +| | | mi | | ++--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/src/wrf/g_cloudfrac.py b/src/wrf/g_cloudfrac.py index 76c4356..10123e4 100644 --- a/src/wrf/g_cloudfrac.py +++ b/src/wrf/g_cloudfrac.py @@ -14,7 +14,7 @@ from .g_geoht import _get_geoht @set_cloudfrac_metadata() def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True, 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)): """Return the cloud fraction for low, mid, and high level clouds. @@ -24,13 +24,6 @@ def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True, - return_val[0,...] will contain LOW level cloud fraction - return_val[1,...] will contain MID 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 default cloud levels are defined as: @@ -38,6 +31,12 @@ def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True, 300 m <= low_cloud < 2000 m 2000 m <= mid_cloud < 6000 m 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 exclude clouds near the surface (fog). If you want fog included, set @@ -95,9 +94,8 @@ def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True, purposes only. Default is None. vert_type (:obj:`str`, optional): The type of vertical coordinate used - to determine cloud type thresholds. Must be 'pres', 'height_msl', - or 'height_agl'. For backwards compatibility, the default - is 'pres'. + to determine cloud type thresholds. Must be 'height_agl', + 'height_msl', or 'pres'. The default is 'height_agl'. low_thresh (:obj:`float`, optional): The lower bound for what is considered a low cloud. If *vert_type* is 'pres', the default is diff --git a/test/utests.py b/test/utests.py index 51f0a97..5f3ede9 100644 --- a/test/utests.py +++ b/test/utests.py @@ -138,6 +138,13 @@ def make_test(varname, wrf_in, referent, multi=False, repeat=3, pynio=False): 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 == "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"): my_vals = getvar(in_wrfnc, "pw", timeidx=timeidx) tol = .5/100.0 @@ -611,6 +618,12 @@ class WRFLatLonTest(ut.TestCase): 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 wrf_vars = ["avo", "eth", "cape_2d", "cape_3d", "ctt", "dbz", "mdbz", "geopt", "helicity", "lat", "lon", "omg", "p", "pressure",