forked from 3rdparty/wrf-python
99 changed files with 6733 additions and 1826 deletions
@ -1,15 +1,25 @@
@@ -1,15 +1,25 @@
|
||||
# wrf-python |
||||
wrf-python |
||||
============== |
||||
|
||||
A collection of diagnostic and interpolation routines for use with output from the Weather Research and Forecasting (WRF-ARW) Model. |
||||
|
||||
This package provides over 30 diagnostic calculations, several interpolation routines, and utilities to help with plotting via cartopy, basemap, or PyNGL. The functionality is similar to what is provided by the NCL WRF package. |
||||
|
||||
|
||||
Installation via conda: |
||||
Installation |
||||
---------------------------- |
||||
|
||||
conda install -c conda-forge wrf-python |
||||
|
||||
Documentation is available at: |
||||
Documentation |
||||
---------------------------------- |
||||
|
||||
http://wrf-python.rtfd.org |
||||
|
||||
|
||||
Citation |
||||
------------------ |
||||
|
||||
Ladwig, W. (2017). wrf-python (Version x.x.x) [Software]. Boulder, Colorado: UCAR/NCAR. https://doi.org/10.5065/D6W094P1 |
||||
|
||||
Note: The version number x.x.x should be set to the version of wrf-python that you are using. |
||||
|
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash |
||||
|
||||
cd ../fortran |
||||
gfortran -E ompgen.F90 -cpp -o omp.f90 |
||||
f2py *.f90 -m _wrffortran -h wrffortran.pyf --overwrite-signature |
||||
cd .. |
||||
|
||||
python setup.py clean --all |
||||
python setup.py config_fc --f90flags="-mtune=generic" build_ext build |
||||
pip install . |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash |
||||
|
||||
cd ../fortran |
||||
gfortran -E ompgen.F90 -fopenmp -cpp -o omp.f90 |
||||
f2py *.f90 -m _wrffortran -h wrffortran.pyf --overwrite-signature |
||||
cd .. |
||||
|
||||
python setup.py clean --all |
||||
python setup.py config_fc --f90flags="-mtune=generic -fopenmp" build_ext --libraries="gomp" build |
||||
pip install . |
||||
|
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
cd ../fortran |
||||
CALL gfortran -E ompgen.F90 -cpp -o omp.f90 |
||||
REM Wildcards not working on Windows for some reason |
||||
CALL f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90 |
||||
cd .. |
||||
|
||||
CALL python setup.py clean --all |
||||
|
||||
IF %PROCESSOR_ARCHITECTURE% == AMD64 ( |
||||
CALL python setup.py config_fc --f90flags="-O2 -mtune=generic" build --compiler=mingw32 --fcompiler=gnu95 |
||||
) ELSE ( |
||||
CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -mincoming-stack-boundary=2" build --compiler=mingw32 --fcompiler=gnu95 |
||||
) |
||||
|
||||
CALL pip install . |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
cd ../fortran |
||||
CALL gfortran -E ompgen.F90 -cpp -fopenmp -o omp.f90 |
||||
REM Wildcards not working on Windows for some reason |
||||
CALLf2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90 |
||||
cd .. |
||||
|
||||
CALL python setup.py clean --all |
||||
|
||||
IF %PROCESSOR_ARCHITECTURE% == AMD64 ( |
||||
CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp" build_ext --libraries="gomp" build --compiler=mingw32 --fcompiler=gnu95 |
||||
) ELSE ( |
||||
CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp -mincoming-stack-boundary=2" build_ext --libraries="gomp" build --compiler=mingw32 --fcompiler=gnu95 |
||||
) |
||||
|
||||
CALL pip install . |
||||
|
||||
|
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
cd ../fortran |
||||
CALL gfortran -E ompgen.F90 -cpp -o omp.f90 |
||||
REM Wildcards not working on Windows for some reason |
||||
CALL f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90 |
||||
cd .. |
||||
|
||||
CALL python setup.py clean --all |
||||
|
||||
IF %PROCESSOR_ARCHITECTURE% == AMD64 ( |
||||
CALL python setup.py config_fc --f90flags="-O2 -mtune=generic" build --compiler=mingw32 --fcompiler=gnu95 |
||||
) ELSE ( |
||||
CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -mincoming-stack-boundary=2" build --compiler=msvc --fcompiler=gnu95 |
||||
) |
||||
CALL pip install . |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
cd ../fortran |
||||
CALL gfortran -E ompgen.F90 -cpp -fopenmp -o omp.f90 |
||||
REM Wildcards not working on Windows for some reason |
||||
CALL f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90 |
||||
cd .. |
||||
|
||||
CALL python setup.py clean --all |
||||
|
||||
IF %PROCESSOR_ARCHITECTURE% == AMD64 ( |
||||
CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp" build_ext --libraries="gomp" build --compiler=msvc --fcompiler=gnu95 |
||||
) ELSE ( |
||||
CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp -mincoming-stack-boundary=2" build_ext --libraries="gomp" build --compiler=msvc --fcompiler=gnu95 |
||||
) |
||||
|
||||
CALL pip install . |
||||
|
@ -1,8 +1,15 @@
@@ -1,8 +1,15 @@
|
||||
cd ./fortran |
||||
CALL gfortran -E ompgen.F90 -cpp -fopenmp -o omp.f90 |
||||
REM Wildcards not working on Windows for some reason |
||||
CALL f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90 |
||||
cd .. |
||||
|
||||
%ARCH% == 64 ( |
||||
%PYTHON% setup.py config_fc --f90flags="-O2 -mtune=generic -mfpmath=sse -msse2" build --compiler=mingw32 --fcompiler=gnu95 |
||||
) else ( |
||||
%PYTHON% setup.py config_fc --f90flags="-O2 -mtune=generic -mfpmath=sse -msse2 -mincoming-stack-boundary=2" build --compiler=mingw32 --fcompiler=gnu95 |
||||
IF %ARCH% == 64 ( |
||||
CALL %PYTHON% setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp" build_ext --libraries="gomp" build --compiler=msvc --fcompiler=gnu95 |
||||
) ELSE ( |
||||
CALL %PYTHON% setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp -mincoming-stack-boundary=2" build_ext --libraries="gomp" build --compiler=msvc --fcompiler=gnu95 |
||||
) |
||||
%PYTHON% setup.py install --single-version-externally-managed --record=record.txt |
||||
|
||||
CALL %PYTHON% setup.py install --single-version-externally-managed --record=record.txt |
||||
|
||||
|
||||
|
@ -1,10 +1,16 @@
@@ -1,10 +1,16 @@
|
||||
#!/bin/bash |
||||
|
||||
cd ./fortran |
||||
gfortran -E ompgen.F90 -fopenmp -cpp -o omp.f90 |
||||
f2py *.f90 -m _wrffortran -h wrffortran.pyf --overwrite-signature |
||||
cd .. |
||||
|
||||
if [ `uname` == Darwin ]; then |
||||
LDFLAGS="$LDFLAGS -undefined dynamic_lookup -bundle" |
||||
fi |
||||
|
||||
$PYTHON setup.py config_fc --f90flags="-mtune=generic -mfpmath=sse" build |
||||
$PYTHON setup.py config_fc --f90flags="-mtune=generic -fopenmp" build_ext --libraries="gomp" build |
||||
|
||||
$PYTHON setup.py install --single-version-externally-managed --record=record.txt |
||||
|
||||
|
||||
|
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
{% set version = "1.1.0" %} |
||||
|
||||
package: |
||||
name: wrf-python |
||||
version: {{ version }} |
||||
|
||||
source: |
||||
git_url: https://github.com/NCAR/wrf-python |
||||
git_branch: develop |
||||
|
||||
|
||||
build: |
||||
number: 0 |
||||
detect_binary_files_with_prefix: true |
||||
|
||||
requirements: |
||||
build: |
||||
- setuptools |
||||
- numpy 1.11.* # [unix] |
||||
- numpy 1.14.* # [win] |
||||
- wrapt |
||||
- m2w64-toolchain # [win] |
||||
- gcc # [unix] |
||||
- python |
||||
run: |
||||
- setuptools |
||||
- numpy >=1.11 |
||||
- python |
||||
- wrapt |
||||
- m2w64-gcc-libs # [win] |
||||
- libgfortran # [unix] |
||||
- libgcc # [unix] |
||||
- xarray |
||||
|
||||
test: |
||||
requires: |
||||
- setuptools |
||||
- netcdf4 |
||||
- xarray |
||||
source_files: |
||||
- test/ci_tests |
||||
imports: |
||||
- wrf |
||||
commands: |
||||
- cd test/ci_tests && python utests.py |
||||
|
||||
about: |
||||
home: https://github.com/NCAR/wrf-python |
||||
license: "UCAR" |
||||
license_file: '{{ environ["RECIPE_DIR"] }}/LICENSE' |
||||
summary: "Diagnostic and interpolation routines for WRF-ARW data." |
||||
|
||||
extra: |
||||
recipe-maintainers: |
||||
- bladwig1 |
||||
- marylhaley |
||||
- david-ian-brown |
||||
- khallock |
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
{% set version = "1.1.0" %} |
||||
|
||||
package: |
||||
name: wrf-python |
||||
version: {{ version }} |
||||
|
||||
source: |
||||
fn: wrf-python-{{ version }}.tar.gz |
||||
url: https://github.com/NCAR/wrf-python/archive/{{ version }}.tar.gz |
||||
sha256: ea2202e1d8237c65b9d77a91f00da0f2e7a37ed6214ddd976872b619b9647b33 |
||||
|
||||
build: |
||||
number: 0 |
||||
detect_binary_files_with_prefix: true |
||||
|
||||
requirements: |
||||
build: |
||||
- setuptools |
||||
- numpy 1.11.* # [unix] |
||||
- numpy 1.14.* # [win] |
||||
- wrapt |
||||
- m2w64-toolchain # [win] |
||||
- gcc # [unix] |
||||
- python |
||||
run: |
||||
- setuptools |
||||
- numpy >=1.11 |
||||
- python |
||||
- wrapt |
||||
- m2w64-gcc-libs # [win] |
||||
- libgfortran # [unix] |
||||
- libgcc # [unix] |
||||
- xarray |
||||
|
||||
test: |
||||
requires: |
||||
- setuptools |
||||
- netcdf4 |
||||
- xarray |
||||
source_files: |
||||
- test/ci_tests |
||||
imports: |
||||
- wrf |
||||
commands: |
||||
- cd test/ci_tests && python utests.py |
||||
|
||||
about: |
||||
home: https://github.com/NCAR/wrf-python |
||||
license: "UCAR" |
||||
license_file: '{{ environ["RECIPE_DIR"] }}/LICENSE' |
||||
summary: "Diagnostic and interpolation routines for WRF-ARW data." |
||||
|
||||
extra: |
||||
recipe-maintainers: |
||||
- bladwig1 |
||||
- marylhaley |
||||
- david-ian-brown |
||||
- khallock |
@ -1,240 +1,256 @@
@@ -1,240 +1,256 @@
|
||||
+--------------------+---------------------------------------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------+ |
||||
| 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 | Geopotential for the Mass Grid | m2 s-2 | | |
||||
+--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ |
||||
| geopt_stag | Geopotential for the Vertically Staggered Grid | 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 | Model Height for Mass Grid | 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 | | |
||||
+--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ |
||||
| zstag | Model Height for Vertically Staggered Grid | 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 | | |
||||
+--------------------+---------------------------------------------------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ |
||||
|
||||
|
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
.. _citation: |
||||
|
||||
Citation |
||||
================= |
||||
|
||||
WRF-Python has a Digital Object Identifier (DOI), which is a persistent |
||||
identifier for web-based resources. The wrf-python DOI, when used in URL form, |
||||
https://doi.org/10.5065/D6W094P1, provides a persistent link to the wrf-python |
||||
Github page. The benefit of DOIs is that they are widely accepted by academic |
||||
publishers as citable locators for scholarly objects. |
||||
|
||||
If you author a paper that involves data analysis with wrf-python, or |
||||
visualizations created with wrf-python, we would like to ask you to please |
||||
cite wrf-python. This helps us better understand the impact of the software on |
||||
the scientific community, which in turns helps us maintain support for the |
||||
effort. |
||||
|
||||
You can cite wrf-python using the following citation: |
||||
|
||||
.. code-block:: none |
||||
|
||||
Ladwig, W. (2017). wrf-python (Version x.x.x) [Software]. Boulder, Colorado: UCAR/NCAR. https://doi.org/10.5065/D6W094P1 |
||||
|
||||
.. note:: |
||||
|
||||
The version number x.x.x should be set to the version of wrf-python that you are using. |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
Tutorials |
||||
============= |
||||
|
||||
NCAR occasionally provides tutorials for wrf-python at various times |
||||
throughout the year. |
||||
|
||||
Below are the links to the upcoming and past tutorials. |
||||
|
||||
Upcoming Tutorials |
||||
--------------------- |
||||
|
||||
.. toctree:: |
||||
:maxdepth: 1 |
||||
|
||||
tutorials/tutorial_03_2018.rst |
||||
|
||||
|
||||
Past Tutorials |
||||
------------------ |
||||
|
||||
.. toctree:: |
||||
:maxdepth: 1 |
||||
|
||||
tutorials/wrf_workshop_2017.rst |
||||
|
@ -0,0 +1,81 @@
@@ -0,0 +1,81 @@
|
||||
WRF-Python Tutorial 2018 |
||||
========================= |
||||
|
||||
NCAR will be providing a four hour tutorial for wrf-python on Wednesday, March |
||||
7, 2018 from 8 AM to 12 PM. The tutorial is free, but seating is limited to |
||||
only 16 students, so registration is required. |
||||
|
||||
The tutorial will take place at NCAR's corporate training center in Boulder, |
||||
Colorado. |
||||
|
||||
`Corporate Technical Training Center <https://www2.fin.ucar.edu/it/about-cttc>`_ |
||||
3085 Center Green Drive, Building CG-2, Room #3024 |
||||
Boulder, Colorado |
||||
|
||||
Overview |
||||
-------------- |
||||
|
||||
This tutorial provides an introduction to wrf-python. The tutorial is beginner |
||||
friendly for new users of wrf-python, but this is not an introduction to the Python |
||||
programming language (see :ref:`prereq`). Due to limited seating, if you |
||||
do not have any previous experience with Python, please do not register |
||||
for this tutorial. |
||||
|
||||
Computers will be provided, but feel free to use your own laptop if you prefer. |
||||
We will be covering how to install wrf-python via conda as part of the |
||||
tutorial. |
||||
|
||||
Students are encouraged to bring their own data sets, but data will be provided |
||||
if this is not an option. Students will be provided a jupyter notebook workbook |
||||
which can be modified to accommodate their data. |
||||
|
||||
Topics include: |
||||
|
||||
- How to install wrf-python via conda |
||||
- A brief introduction to jupyter notebook |
||||
- Overview of WRF data files |
||||
- WRF-Python basics |
||||
- Plotting with cartopy |
||||
- Overview of OpenMP features and other performance tips |
||||
- Open lab for students |
||||
|
||||
|
||||
Registration |
||||
--------------- |
||||
|
||||
Please register prior to February 21, 2018. The registration form is here: |
||||
|
||||
`Registration Form <https://goo.gl/forms/is5VExf3w4bFGXUb2>`_ |
||||
|
||||
Registration consists of a brief survey, which will help give the instructors |
||||
a brief overview of your background and will help tailor the tutorial to |
||||
your expectations. |
||||
|
||||
.. _prereq: |
||||
|
||||
Prerequisites |
||||
--------------- |
||||
|
||||
This tutorial assumes that you have basic knowledge of how to type commands |
||||
in to a terminal window using your preferred operating system. You |
||||
should know some basic directory commands like *cd*, *mkdir*, *cp*, *mv*. |
||||
|
||||
This tutorial assumes that you have prior experience programming in Python. |
||||
Below is a list of some Python concepts that you will see in the examples, |
||||
but don't worry if you aren't familiar with everything. |
||||
|
||||
- Opening a Python interpreter and entering commands. |
||||
- Importing packages via the import statement. |
||||
- Familiarity with some of the basic Python types: str, list, tuple, dict, bool, float, int, None. |
||||
- Creating a list, tuple, or dict with "[ ]", "( )", "{ }" syntax (e.g. my_list = [1,2,3,4,5]). |
||||
- Accessing dict/list/tuple items with the "x[ ]" syntax (e.g. my_list_item = my_list[0]). |
||||
- Slicing str/list/tuple with the ":" syntax (e.g. my_slice = my_list[1:3]). |
||||
- Using object methods and attributes with the "x.y" syntax (e.g. my_list.append(6)). |
||||
- Calling functions (e.g. result = some_function(x, y)) |
||||
- Familiarity with numpy would be helpful, as only a very brief introduction |
||||
is provided. |
||||
- Familiarity with matplotlib would be helpful, as only a very brief |
||||
introduction is provided. |
||||
|
||||
|
||||
|
@ -0,0 +1,465 @@
@@ -0,0 +1,465 @@
|
||||
|
||||
MODULE omp_constants |
||||
INTEGER, PARAMETER :: fomp_sched_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_lock_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_nest_lock_kind = 8 |
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_static = 1 |
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_dynamic = 2 |
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_guided = 3 |
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_auto = 4 |
||||
END MODULE omp_constants |
||||
|
||||
|
||||
FUNCTION fomp_enabled() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL :: fomp_enabled |
||||
|
||||
fomp_enabled = .FALSE. |
||||
|
||||
END FUNCTION fomp_enabled |
||||
|
||||
|
||||
SUBROUTINE fomp_set_num_threads(num_threads) |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER, INTENT(IN) :: num_threads |
||||
IF (.FALSE.) PRINT *, num_threads |
||||
|
||||
END SUBROUTINE fomp_set_num_threads |
||||
|
||||
|
||||
FUNCTION fomp_get_num_threads() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_num_threads |
||||
|
||||
fomp_get_num_threads = -1 |
||||
|
||||
END FUNCTION fomp_get_num_threads |
||||
|
||||
|
||||
FUNCTION fomp_get_max_threads() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_max_threads |
||||
|
||||
fomp_get_max_threads = -1 |
||||
|
||||
END FUNCTION fomp_get_max_threads |
||||
|
||||
|
||||
FUNCTION fomp_get_thread_num() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_thread_num |
||||
|
||||
fomp_get_thread_num = -1 |
||||
|
||||
END FUNCTION fomp_get_thread_num |
||||
|
||||
|
||||
FUNCTION fomp_get_num_procs() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_num_procs |
||||
|
||||
fomp_get_num_procs = -1 |
||||
|
||||
END FUNCTION fomp_get_num_procs |
||||
|
||||
|
||||
FUNCTION fomp_in_parallel() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL :: fomp_in_parallel |
||||
|
||||
fomp_in_parallel = .FALSE. |
||||
|
||||
END FUNCTION fomp_in_parallel |
||||
|
||||
|
||||
SUBROUTINE fomp_set_dynamic(dynamic_threads) |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL, INTENT(IN) :: dynamic_threads |
||||
IF (.FALSE.) PRINT *, dynamic_threads |
||||
|
||||
END SUBROUTINE fomp_set_dynamic |
||||
|
||||
|
||||
FUNCTION fomp_get_dynamic() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL :: fomp_get_dynamic |
||||
|
||||
fomp_get_dynamic = .FALSE. |
||||
|
||||
END FUNCTION fomp_get_dynamic |
||||
|
||||
|
||||
SUBROUTINE fomp_set_nested(nested) |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL, INTENT(IN) :: nested |
||||
IF (.FALSE.) PRINT *, nested |
||||
|
||||
END SUBROUTINE fomp_set_nested |
||||
|
||||
|
||||
FUNCTION fomp_get_nested() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL :: fomp_get_nested |
||||
|
||||
fomp_get_nested = .FALSE. |
||||
|
||||
END FUNCTION fomp_get_nested |
||||
|
||||
|
||||
SUBROUTINE fomp_set_schedule(kind, modifier) |
||||
|
||||
USE omp_constants, ONLY : fomp_sched_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_sched_kind), INTENT(IN) :: kind |
||||
INTEGER, INTENT(IN) :: modifier |
||||
IF (.FALSE.) PRINT *, kind, modifier |
||||
|
||||
END SUBROUTINE fomp_set_schedule |
||||
|
||||
|
||||
SUBROUTINE fomp_get_schedule(kind, modifier) |
||||
|
||||
USE omp_constants, ONLY : fomp_sched_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_sched_kind), INTENT(OUT) :: kind |
||||
INTEGER, INTENT(OUT) :: modifier |
||||
|
||||
kind = -1 |
||||
modifier = -1 |
||||
|
||||
END SUBROUTINE fomp_get_schedule |
||||
|
||||
|
||||
FUNCTION fomp_get_thread_limit() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_thread_limit |
||||
|
||||
fomp_get_thread_limit = -1 |
||||
|
||||
END FUNCTION fomp_get_thread_limit |
||||
|
||||
|
||||
SUBROUTINE fomp_set_max_active_levels(max_levels) |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER, INTENT(IN) :: max_levels |
||||
IF (.FALSE.) PRINT *, max_levels |
||||
|
||||
END SUBROUTINE fomp_set_max_active_levels |
||||
|
||||
|
||||
FUNCTION fomp_get_max_active_levels() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_max_active_levels |
||||
|
||||
fomp_get_max_active_levels = -1 |
||||
|
||||
END FUNCTION fomp_get_max_active_levels |
||||
|
||||
|
||||
FUNCTION fomp_get_level() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_level |
||||
|
||||
fomp_get_level = -1 |
||||
|
||||
END FUNCTION fomp_get_level |
||||
|
||||
|
||||
FUNCTION fomp_get_ancestor_thread_num(level) |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER, INTENT(IN) :: level |
||||
INTEGER :: fomp_get_ancestor_thread_num |
||||
IF (.FALSE.) PRINT *, level |
||||
|
||||
fomp_get_ancestor_thread_num = -1 |
||||
|
||||
END FUNCTION fomp_get_ancestor_thread_num |
||||
|
||||
|
||||
FUNCTION fomp_get_team_size(level) |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER, INTENT(IN) :: level |
||||
INTEGER :: fomp_get_team_size |
||||
IF (.FALSE.) PRINT *, level |
||||
|
||||
fomp_get_team_size = -1 |
||||
|
||||
END FUNCTION fomp_get_team_size |
||||
|
||||
|
||||
FUNCTION fomp_get_active_level() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_active_level |
||||
|
||||
fomp_get_active_level = -1 |
||||
|
||||
END FUNCTION fomp_get_active_level |
||||
|
||||
|
||||
FUNCTION fomp_in_final() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL :: fomp_in_final |
||||
|
||||
fomp_in_final = .FALSE. |
||||
|
||||
END FUNCTION fomp_in_final |
||||
|
||||
|
||||
SUBROUTINE fomp_init_lock(svar) |
||||
|
||||
USE omp_constants, ONLY : fomp_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_lock_kind), INTENT(OUT) :: svar |
||||
|
||||
svar = -1 |
||||
|
||||
END SUBROUTINE fomp_init_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_init_nest_lock(nvar) |
||||
|
||||
USE omp_constants, ONLY : fomp_nest_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_nest_lock_kind), INTENT(OUT) :: nvar |
||||
|
||||
nvar = -1 |
||||
|
||||
END SUBROUTINE fomp_init_nest_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_destroy_lock(svar) |
||||
|
||||
USE omp_constants, ONLY : fomp_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_lock_kind), INTENT(INOUT) :: svar |
||||
IF (.FALSE.) PRINT *, svar |
||||
|
||||
END SUBROUTINE fomp_destroy_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_destroy_nest_lock(nvar) |
||||
|
||||
USE omp_constants, ONLY : fomp_nest_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_nest_lock_kind), INTENT(INOUT) :: nvar |
||||
IF (.FALSE.) PRINT *, nvar |
||||
|
||||
END SUBROUTINE fomp_destroy_nest_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_set_lock(svar) |
||||
|
||||
USE omp_constants, ONLY : fomp_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_lock_kind), INTENT(INOUT) :: svar |
||||
IF (.FALSE.) PRINT *, svar |
||||
|
||||
END SUBROUTINE fomp_set_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_set_nest_lock(nvar) |
||||
|
||||
USE omp_constants, ONLY : fomp_nest_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_nest_lock_kind), INTENT(INOUT) :: nvar |
||||
IF (.FALSE.) PRINT *, nvar |
||||
|
||||
END SUBROUTINE fomp_set_nest_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_unset_lock(svar) |
||||
|
||||
USE omp_constants, ONLY : fomp_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_lock_kind), INTENT(INOUT) :: svar |
||||
IF (.FALSE.) PRINT *, svar |
||||
|
||||
END SUBROUTINE fomp_unset_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_unset_nest_lock(nvar) |
||||
|
||||
USE omp_constants, ONLY : fomp_nest_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_nest_lock_kind), INTENT(INOUT) :: nvar |
||||
IF (.FALSE.) PRINT *, nvar |
||||
|
||||
END SUBROUTINE fomp_unset_nest_lock |
||||
|
||||
|
||||
FUNCTION fomp_test_lock(svar) |
||||
|
||||
USE omp_constants, ONLY : fomp_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_lock_kind), INTENT(INOUT) :: svar |
||||
LOGICAL :: fomp_test_lock |
||||
IF (.FALSE.) PRINT *, svar |
||||
|
||||
fomp_test_lock = .FALSE. |
||||
|
||||
END FUNCTION fomp_test_lock |
||||
|
||||
|
||||
FUNCTION fomp_test_nest_lock(nvar) |
||||
|
||||
USE omp_constants, ONLY : fomp_nest_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_nest_lock_kind), INTENT(INOUT) :: nvar |
||||
INTEGER :: fomp_test_nest_lock |
||||
IF (.FALSE.) PRINT *, nvar |
||||
|
||||
fomp_test_nest_lock = -1 |
||||
|
||||
END FUNCTION fomp_test_nest_lock |
||||
|
||||
|
||||
FUNCTION fomp_get_wtime() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
REAL (KIND=8) :: fomp_get_wtime |
||||
|
||||
fomp_get_wtime = -1 |
||||
|
||||
END FUNCTION fomp_get_wtime |
||||
|
||||
|
||||
FUNCTION fomp_get_wtick() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
REAL (KIND=8) :: fomp_get_wtick |
||||
|
||||
fomp_get_wtick = -1 |
||||
|
||||
END FUNCTION fomp_get_wtick |
||||
|
||||
|
@ -0,0 +1,753 @@
@@ -0,0 +1,753 @@
|
||||
MODULE omp_constants |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
! f2py can't figure this out without me making a map of these kinds to |
||||
! c types, so we're going to have to hard code the kinds below. |
||||
!INTEGER, PARAMETER :: fomp_sched_kind = omp_sched_kind |
||||
!INTEGER, PARAMETER :: fomp_nest_lock_kind = omp_nest_lock_kind |
||||
!INTEGER, PARAMETER :: fomp_lock_kind = omp_lock_kind |
||||
|
||||
! Note: Defining these specifically is the only way I can get f2py to |
||||
! work without doing the same thing in a mapping file. The values below |
||||
! are for GNU on 64bit. This may not be entirely correct for non-GNU |
||||
! compilers. In particular, it will be the locks that segfault/crash if |
||||
! this is wrong. |
||||
#if defined(__GFORTRAN__) |
||||
#if (__SIZEOF_POINTER__ == 8) |
||||
INTEGER, PARAMETER :: fomp_sched_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_lock_kind = 8 |
||||
INTEGER, PARAMETER :: fomp_nest_lock_kind = 8 |
||||
#else |
||||
INTEGER, PARAMETER :: fomp_sched_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_lock_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_nest_lock_kind = 4 |
||||
#endif |
||||
#elif defined(__INTEL_COMPILER_BUILD_DATE) |
||||
#if defined(__x86_64__) || defined(_M_X64) |
||||
INTEGER, PARAMETER :: fomp_sched_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_lock_kind = 8 |
||||
INTEGER, PARAMETER :: fomp_nest_lock_kind = 8 |
||||
#else |
||||
INTEGER, PARAMETER :: fomp_sched_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_lock_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_nest_lock_kind = 4 |
||||
#endif |
||||
#elif defined(__PGI) |
||||
#if defined(__x86_64__) |
||||
INTEGER, PARAMETER :: fomp_sched_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_lock_kind = 8 |
||||
INTEGER, PARAMETER :: fomp_nest_lock_kind = 8 |
||||
#else |
||||
INTEGER, PARAMETER :: fomp_sched_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_lock_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_nest_lock_kind = 4 |
||||
#endif |
||||
#endif |
||||
|
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_static = omp_sched_static |
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_dynamic = omp_sched_dynamic |
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_guided = omp_sched_guided |
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_auto = omp_sched_auto |
||||
#else |
||||
INTEGER, PARAMETER :: fomp_sched_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_lock_kind = 4 |
||||
INTEGER, PARAMETER :: fomp_nest_lock_kind = 8 |
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_static = 1 |
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_dynamic = 2 |
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_guided = 3 |
||||
INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_auto = 4 |
||||
#endif |
||||
|
||||
END MODULE omp_constants |
||||
|
||||
|
||||
FUNCTION fomp_enabled() |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL :: fomp_enabled |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_enabled = .TRUE. |
||||
#else |
||||
fomp_enabled = .FALSE. |
||||
#endif |
||||
|
||||
END FUNCTION fomp_enabled |
||||
|
||||
|
||||
SUBROUTINE fomp_set_num_threads(num_threads) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER, INTENT(IN) :: num_threads |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_set_num_threads(num_threads) |
||||
#else |
||||
IF (.FALSE.) PRINT *, num_threads |
||||
#endif |
||||
|
||||
|
||||
END SUBROUTINE fomp_set_num_threads |
||||
|
||||
|
||||
FUNCTION fomp_get_num_threads() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_num_threads |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_num_threads = omp_get_num_threads() |
||||
#else |
||||
fomp_get_num_threads = -1 |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_num_threads |
||||
|
||||
|
||||
FUNCTION fomp_get_max_threads() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_max_threads |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_max_threads = omp_get_max_threads() |
||||
#else |
||||
fomp_get_max_threads = -1 |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_max_threads |
||||
|
||||
|
||||
FUNCTION fomp_get_thread_num() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_thread_num |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_thread_num = omp_get_thread_num() |
||||
#else |
||||
fomp_get_thread_num = -1 |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_thread_num |
||||
|
||||
|
||||
FUNCTION fomp_get_num_procs() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_num_procs |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_num_procs = omp_get_num_procs() |
||||
#else |
||||
fomp_get_num_procs = -1 |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_num_procs |
||||
|
||||
|
||||
FUNCTION fomp_in_parallel() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL :: fomp_in_parallel |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_in_parallel = omp_in_parallel() |
||||
#else |
||||
fomp_in_parallel = .FALSE. |
||||
#endif |
||||
|
||||
END FUNCTION fomp_in_parallel |
||||
|
||||
|
||||
SUBROUTINE fomp_set_dynamic(dynamic_threads) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL, INTENT(IN) :: dynamic_threads |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_set_dynamic(dynamic_threads) |
||||
#else |
||||
IF (.FALSE.) PRINT *, dynamic_threads |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_set_dynamic |
||||
|
||||
|
||||
FUNCTION fomp_get_dynamic() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL :: fomp_get_dynamic |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_dynamic = omp_get_dynamic() |
||||
#else |
||||
fomp_get_dynamic = .FALSE. |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_dynamic |
||||
|
||||
|
||||
SUBROUTINE fomp_set_nested(nested) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL, INTENT(IN) :: nested |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_set_nested(nested) |
||||
#else |
||||
IF (.FALSE.) PRINT *, nested |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_set_nested |
||||
|
||||
|
||||
FUNCTION fomp_get_nested() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL :: fomp_get_nested |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_nested = omp_get_nested() |
||||
#else |
||||
fomp_get_nested = .FALSE. |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_nested |
||||
|
||||
|
||||
SUBROUTINE fomp_set_schedule(kind, modifier) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_sched_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_sched_kind), INTENT(IN) :: kind |
||||
INTEGER, INTENT(IN) :: modifier |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_set_schedule(kind, modifier) |
||||
#else |
||||
IF (.FALSE.) PRINT *, kind, modifier |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_set_schedule |
||||
|
||||
|
||||
SUBROUTINE fomp_get_schedule(kind, modifier) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_sched_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_sched_kind), INTENT(OUT) :: kind |
||||
INTEGER, INTENT(OUT) :: modifier |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_get_schedule(kind, modifier) |
||||
#else |
||||
kind = -1 |
||||
modifier = -1 |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_get_schedule |
||||
|
||||
|
||||
FUNCTION fomp_get_thread_limit() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_thread_limit |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_thread_limit = omp_get_thread_limit() |
||||
#else |
||||
fomp_get_thread_limit = -1 |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_thread_limit |
||||
|
||||
|
||||
SUBROUTINE fomp_set_max_active_levels(max_levels) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER, INTENT(IN) :: max_levels |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_set_max_active_levels(max_levels) |
||||
#else |
||||
IF (.FALSE.) PRINT *, max_levels |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_set_max_active_levels |
||||
|
||||
|
||||
FUNCTION fomp_get_max_active_levels() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_max_active_levels |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_max_active_levels = omp_get_max_active_levels() |
||||
#else |
||||
fomp_get_max_active_levels = -1 |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_max_active_levels |
||||
|
||||
|
||||
FUNCTION fomp_get_level() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_level |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_level = omp_get_level() |
||||
#else |
||||
fomp_get_level = -1 |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_level |
||||
|
||||
|
||||
FUNCTION fomp_get_ancestor_thread_num(level) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER, INTENT(IN) :: level |
||||
INTEGER :: fomp_get_ancestor_thread_num |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_ancestor_thread_num = omp_get_ancestor_thread_num(level) |
||||
#else |
||||
IF (.FALSE.) PRINT *, level |
||||
fomp_get_ancestor_thread_num = -1 |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_ancestor_thread_num |
||||
|
||||
|
||||
FUNCTION fomp_get_team_size(level) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER, INTENT(IN) :: level |
||||
INTEGER :: fomp_get_team_size |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_team_size = omp_get_team_size(level) |
||||
#else |
||||
IF (.FALSE.) PRINT *, level |
||||
fomp_get_team_size = -1 |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_team_size |
||||
|
||||
|
||||
FUNCTION fomp_get_active_level() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER :: fomp_get_active_level |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_active_level = omp_get_active_level() |
||||
#else |
||||
fomp_get_active_level = -1 |
||||
#endif |
||||
|
||||
END FUNCTION fomp_get_active_level |
||||
|
||||
|
||||
FUNCTION fomp_in_final() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
LOGICAL :: fomp_in_final |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_in_final = omp_in_final() |
||||
#else |
||||
fomp_in_final = .FALSE. |
||||
#endif |
||||
|
||||
END FUNCTION fomp_in_final |
||||
|
||||
|
||||
SUBROUTINE fomp_init_lock(svar) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_lock_kind), INTENT(OUT) :: svar |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_init_lock(svar) |
||||
#else |
||||
svar = -1 |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_init_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_init_nest_lock(nvar) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_nest_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_nest_lock_kind), INTENT(OUT) :: nvar |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_init_nest_lock(nvar) |
||||
#else |
||||
nvar = -1 |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_init_nest_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_destroy_lock(svar) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_lock_kind), INTENT(INOUT) :: svar |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_destroy_lock(svar) |
||||
#else |
||||
IF (.FALSE.) PRINT *, svar |
||||
#endif |
||||
|
||||
|
||||
END SUBROUTINE fomp_destroy_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_destroy_nest_lock(nvar) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_nest_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_nest_lock_kind), INTENT(INOUT) :: nvar |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_destroy_nest_lock(nvar) |
||||
#else |
||||
IF (.FALSE.) PRINT *, nvar |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_destroy_nest_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_set_lock(svar) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_lock_kind), INTENT(INOUT) :: svar |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_set_lock(svar) |
||||
#else |
||||
IF (.FALSE.) PRINT *, svar |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_set_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_set_nest_lock(nvar) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_nest_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_nest_lock_kind), INTENT(INOUT) :: nvar |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_set_nest_lock(nvar) |
||||
#else |
||||
IF (.FALSE.) PRINT *, nvar |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_set_nest_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_unset_lock(svar) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_lock_kind), INTENT(INOUT) :: svar |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_unset_lock(svar) |
||||
#else |
||||
IF (.FALSE.) PRINT *, svar |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_unset_lock |
||||
|
||||
|
||||
SUBROUTINE fomp_unset_nest_lock(nvar) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_nest_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_nest_lock_kind), INTENT(INOUT) :: nvar |
||||
|
||||
#ifdef _OPENMP |
||||
CALL omp_unset_nest_lock(nvar) |
||||
#else |
||||
IF (.FALSE.) PRINT *, nvar |
||||
#endif |
||||
|
||||
END SUBROUTINE fomp_unset_nest_lock |
||||
|
||||
|
||||
FUNCTION fomp_test_lock(svar) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_lock_kind), INTENT(INOUT) :: svar |
||||
LOGICAL :: fomp_test_lock |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_test_lock = omp_test_lock(svar) |
||||
#else |
||||
IF (.FALSE.) PRINT *, svar |
||||
fomp_test_lock = .FALSE. |
||||
#endif |
||||
|
||||
|
||||
|
||||
END FUNCTION fomp_test_lock |
||||
|
||||
|
||||
FUNCTION fomp_test_nest_lock(nvar) |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
USE omp_constants, ONLY : fomp_nest_lock_kind |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
INTEGER(KIND=fomp_nest_lock_kind), INTENT(INOUT) :: nvar |
||||
INTEGER :: fomp_test_nest_lock |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_test_nest_lock = omp_test_nest_lock(nvar) |
||||
#else |
||||
IF (.FALSE.) PRINT *, nvar |
||||
fomp_test_nest_lock = -1 |
||||
#endif |
||||
|
||||
|
||||
|
||||
END FUNCTION fomp_test_nest_lock |
||||
|
||||
|
||||
FUNCTION fomp_get_wtime() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
REAL (KIND=8) :: fomp_get_wtime |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_wtime = omp_get_wtime() |
||||
#else |
||||
fomp_get_wtime = -1 |
||||
#endif |
||||
|
||||
|
||||
|
||||
END FUNCTION fomp_get_wtime |
||||
|
||||
|
||||
FUNCTION fomp_get_wtick() |
||||
#ifdef _OPENMP |
||||
USE omp_lib |
||||
#endif |
||||
|
||||
IMPLICIT NONE |
||||
|
||||
!f2py threadsafe |
||||
|
||||
REAL (KIND=8) :: fomp_get_wtick |
||||
|
||||
#ifdef _OPENMP |
||||
fomp_get_wtick = omp_get_wtick() |
||||
#else |
||||
fomp_get_wtick = -1 |
||||
#endif |
||||
|
||||
|
||||
|
||||
END FUNCTION fomp_get_wtick |
||||
|
||||
|
@ -1,2 +1,3 @@
@@ -1,2 +1,3 @@
|
||||
numpy>=1.10 |
||||
numpy>=1.11 |
||||
wrapt>=1.10 |
||||
setuptools>=38.0 |
||||
|
@ -1,88 +0,0 @@
@@ -1,88 +0,0 @@
|
||||
from __future__ import (absolute_import, division, print_function, |
||||
unicode_literals) |
||||
|
||||
from .constants import Constants |
||||
from .extension import _tk, _rh, _cloudfrac |
||||
from .metadecorators import set_cloudfrac_metadata |
||||
from .util import extract_vars |
||||
|
||||
@set_cloudfrac_metadata() |
||||
def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True, |
||||
cache=None, meta=True, _key=None): |
||||
"""Return the cloud fraction. |
||||
|
||||
The leftmost dimension of the returned array represents three different |
||||
quantities: |
||||
|
||||
- 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 |
||||
|
||||
This functions extracts the necessary variables from the NetCDF file |
||||
object in order to perform the calculation. |
||||
|
||||
Args: |
||||
|
||||
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \ |
||||
iterable): WRF-ARW NetCDF |
||||
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile` |
||||
or an iterable sequence of the aforementioned types. |
||||
|
||||
timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The |
||||
desired time index. This value can be a positive integer, |
||||
negative integer, or |
||||
:data:`wrf.ALL_TIMES` (an alias for None) to return |
||||
all times in the file or sequence. The default is 0. |
||||
|
||||
method (:obj:`str`, optional): The aggregation method to use for |
||||
sequences. Must be either 'cat' or 'join'. |
||||
'cat' combines the data along the Time dimension. |
||||
'join' creates a new dimension for the file index. |
||||
The default is 'cat'. |
||||
|
||||
squeeze (:obj:`bool`, optional): Set to False to prevent dimensions |
||||
with a size of 1 from being automatically removed from the shape |
||||
of the output. Default is True. |
||||
|
||||
cache (:obj:`dict`, optional): A dictionary of (varname, ndarray) |
||||
that can be used to supply pre-extracted NetCDF variables to the |
||||
computational routines. It is primarily used for internal |
||||
purposes, but can also be used to improve performance by |
||||
eliminating the need to repeatedly extract the same variables |
||||
used in multiple diagnostics calculations, particularly when using |
||||
large sequences of files. |
||||
Default is None. |
||||
|
||||
meta (:obj:`bool`, optional): Set to False to disable metadata and |
||||
return :class:`numpy.ndarray` instead of |
||||
:class:`xarray.DataArray`. Default is True. |
||||
|
||||
_key (:obj:`int`, optional): A caching key. This is used for internal |
||||
purposes only. Default is None. |
||||
|
||||
Returns: |
||||
:class:`xarray.DataArray` or :class:`numpy.ndarray`: The |
||||
cloud fraction array whose leftmost dimension is 3 (LOW=0, MID=1, |
||||
HIGH=2). |
||||
If xarray is enabled and the *meta* parameter is True, then the result |
||||
will be a :class:`xarray.DataArray` object. Otherwise, the result will |
||||
be a :class:`numpy.ndarray` object with no metadata. |
||||
|
||||
""" |
||||
|
||||
ncvars = extract_vars(wrfin, timeidx, ("P", "PB", "QVAPOR", "T"), |
||||
method, squeeze, cache, meta=False, |
||||
_key=_key) |
||||
|
||||
p = ncvars["P"] |
||||
pb = ncvars["PB"] |
||||
qv = ncvars["QVAPOR"] |
||||
t = ncvars["T"] |
||||
|
||||
full_p = p + pb |
||||
full_t = t + Constants.T_BASE |
||||
|
||||
tk = _tk(full_p, full_t) |
||||
rh = _rh(qv, full_p, tk) |
||||
|
||||
return _cloudfrac(full_p, rh) |
@ -0,0 +1,164 @@
@@ -0,0 +1,164 @@
|
||||
from __future__ import (absolute_import, division, print_function, |
||||
unicode_literals) |
||||
|
||||
import numpy as np |
||||
import numpy.ma as ma |
||||
|
||||
from .constants import Constants, default_fill |
||||
from .extension import _tk, _rh, _cloudfrac |
||||
from .metadecorators import set_cloudfrac_metadata |
||||
from .util import extract_vars |
||||
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="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. |
||||
|
||||
The leftmost dimension of the returned array represents three different |
||||
quantities: |
||||
|
||||
- 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 |
||||
|
||||
If the vertical coordinate type is 'height_agl' or 'height_msl', the |
||||
default cloud levels are defined as: |
||||
|
||||
300 m <= low_cloud < 2000 m |
||||
2000 m <= mid_cloud < 6000 m |
||||
6000 m <= high_cloud |
||||
|
||||
For 'pressure', 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 |
||||
*low_thresh* to ~99500 Pa if *vert_type* is set to 'pressure', or 15 m if |
||||
using 'height_msl' or 'height_agl'. Keep in mind that the lowest mass grid |
||||
points are slightly above the ground, and in order to find clouds, the |
||||
*low_thresh* needs to be set to values that are slightly greater than |
||||
(less than) the lowest height (pressure) values. |
||||
|
||||
When using 'pressure' or 'height_agl' for *vert_type*, there is a |
||||
possibility that the lowest WRF level will be higher than the low_cloud or |
||||
mid_cloud threshold, particularly for mountainous regions. When this |
||||
happens, a fill value will be used in the output. |
||||
|
||||
This functions extracts the necessary variables from the NetCDF file |
||||
object in order to perform the calculation. |
||||
|
||||
Args: |
||||
|
||||
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \ |
||||
iterable): WRF-ARW NetCDF |
||||
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile` |
||||
or an iterable sequence of the aforementioned types. |
||||
|
||||
timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The |
||||
desired time index. This value can be a positive integer, |
||||
negative integer, or |
||||
:data:`wrf.ALL_TIMES` (an alias for None) to return |
||||
all times in the file or sequence. The default is 0. |
||||
|
||||
method (:obj:`str`, optional): The aggregation method to use for |
||||
sequences. Must be either 'cat' or 'join'. |
||||
'cat' combines the data along the Time dimension. |
||||
'join' creates a new dimension for the file index. |
||||
The default is 'cat'. |
||||
|
||||
squeeze (:obj:`bool`, optional): Set to False to prevent dimensions |
||||
with a size of 1 from being automatically removed from the shape |
||||
of the output. Default is True. |
||||
|
||||
cache (:obj:`dict`, optional): A dictionary of (varname, ndarray) |
||||
that can be used to supply pre-extracted NetCDF variables to the |
||||
computational routines. It is primarily used for internal |
||||
purposes, but can also be used to improve performance by |
||||
eliminating the need to repeatedly extract the same variables |
||||
used in multiple diagnostics calculations, particularly when using |
||||
large sequences of files. |
||||
Default is None. |
||||
|
||||
meta (:obj:`bool`, optional): Set to False to disable metadata and |
||||
return :class:`numpy.ndarray` instead of |
||||
:class:`xarray.DataArray`. Default is True. |
||||
|
||||
_key (:obj:`int`, optional): A caching key. This is used for internal |
||||
purposes only. Default is None. |
||||
|
||||
vert_type (:obj:`str`, optional): The type of vertical coordinate used |
||||
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 |
||||
97000 Pa. If *vert_type* is 'height_agl' or 'height_msl', then the |
||||
default is 300 m. |
||||
|
||||
mid_thresh (:obj:`float`, optional): The lower bound for what is |
||||
considered a mid level cloud. If *vert_type* is 'pres', the |
||||
default is 80000 Pa. If *vert_type* is 'height_agl' or |
||||
'height_msl', then the default is 2000 m. |
||||
|
||||
high_thresh (:obj:`float`, optional): The lower bound for what is |
||||
considered a high level cloud. If *vert_type* is 'pres', the |
||||
default is 45000 Pa. If *vert_type* is 'height_agl' or |
||||
'height_msl', then the default is 6000 m. |
||||
|
||||
Returns: |
||||
:class:`xarray.DataArray` or :class:`numpy.ndarray`: The |
||||
cloud fraction array whose leftmost dimension is 3 (LOW=0, MID=1, |
||||
HIGH=2). |
||||
If xarray is enabled and the *meta* parameter is True, then the result |
||||
will be a :class:`xarray.DataArray` object. Otherwise, the result will |
||||
be a :class:`numpy.ndarray` object with no metadata. |
||||
|
||||
""" |
||||
|
||||
ncvars = extract_vars(wrfin, timeidx, ("P", "PB", "QVAPOR", "T"), |
||||
method, squeeze, cache, meta=False, |
||||
_key=_key) |
||||
|
||||
p = ncvars["P"] |
||||
pb = ncvars["PB"] |
||||
qv = ncvars["QVAPOR"] |
||||
t = ncvars["T"] |
||||
|
||||
full_p = p + pb |
||||
full_t = t + Constants.T_BASE |
||||
|
||||
tk = _tk(full_p, full_t) |
||||
rh = _rh(qv, full_p, tk) |
||||
|
||||
if vert_type.lower() == "pres" or vert_type.lower() == "pressure": |
||||
v_coord = full_p |
||||
_low_thresh = 97000. if low_thresh is None else low_thresh |
||||
_mid_thresh = 80000. if mid_thresh is None else mid_thresh |
||||
_high_thresh = 45000. if high_thresh is None else high_thresh |
||||
vert_inc_w_height = 0 |
||||
elif (vert_type.lower() == "height_msl" |
||||
or vert_type.lower() == "height_agl"): |
||||
is_msl = vert_type.lower() == "height_msl" |
||||
v_coord = _get_geoht(wrfin, timeidx, method, squeeze, |
||||
cache, meta=False, _key=_key, height=True, |
||||
msl=is_msl) |
||||
_low_thresh = 300. if low_thresh is None else low_thresh |
||||
_mid_thresh = 2000. if mid_thresh is None else mid_thresh |
||||
_high_thresh = 6000. if high_thresh is None else high_thresh |
||||
vert_inc_w_height = 1 |
||||
else: |
||||
raise ValueError("'vert_type' must be 'pres', 'height_msl', " |
||||
"or 'height_agl'") |
||||
|
||||
cfrac = _cloudfrac(v_coord, rh, vert_inc_w_height, |
||||
_low_thresh, _mid_thresh, _high_thresh, missing) |
||||
|
||||
return ma.masked_values(cfrac, missing) |
||||
|
@ -1,2 +1,2 @@
@@ -1,2 +1,2 @@
|
||||
__version__ = "1.0.5" |
||||
__version__ = "1.1.0" |
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
from __future__ import (absolute_import, division, print_function, unicode_literals) |
||||
|
||||
from wrf import getvar |
||||
from netCDF4 import Dataset as nc |
||||
#ncfile = nc("/Users/ladwig/Documents/wrf_files/wrfout_d01_2016-02-25_18_00_00") |
||||
ncfile = nc("/Users/ladwig/Documents/wrf_files/wrfout_d01_2016-10-07_00_00_00") |
||||
|
||||
def gen_seq(): |
||||
wrfseq = [ncfile, ncfile, ncfile] |
||||
for wrf in wrfseq: |
||||
yield wrf |
||||
|
||||
p_gen = getvar(gen_seq(), "P", method="join") |
||||
|
||||
print(p_gen) |
||||
del p_gen |
||||
|
@ -1,6 +1,18 @@
@@ -1,6 +1,18 @@
|
||||
; Bug1: This segfaults |
||||
l = NewList("fifo") |
||||
name = "foo" |
||||
ListAppend(l, (/name/)) |
||||
print(l) |
||||
print(l[0]) |
||||
name = "bar" |
||||
|
||||
; Bug2 Variables disappear |
||||
a = addfile("/Users/ladwig/Documents/wrf_files/wrfout_d02_2010-06-13_21:00:00.nc", "r") |
||||
b := wrf_user_getvar(a, "slp", -1) |
||||
c = NewList("fifo") |
||||
ListAppend(c, (/b/)) |
||||
b := wrf_user_getvar(a, "rh", -1) |
||||
ListAppend(c, (/b/)) |
||||
|
||||
print(c[0]) |
||||
print(c[1]) ; Variables start disappearing |
||||
|
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
import sys |
||||
import os |
||||
|
||||
try: |
||||
from unittest.mock import MagicMock |
||||
except ImportError: |
||||
from mock import Mock as MagicMock |
||||
|
||||
class Mock(MagicMock): |
||||
@classmethod |
||||
def __getattr__(cls, name): |
||||
return Mock() |
||||
|
||||
MOCK_MODULES = ["numpy", "numpy.ma", "xarray", "cartopy", |
||||
"pandas", "matplotlib", "netCDF4", "mpl_toolkits.basemap", |
||||
"wrf._wrffortran"] |
||||
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) |
||||
|
||||
consts = {"DEFAULT_FILL" : 9.9692099683868690E36, |
||||
"DEFAULT_FILL_INT8" : -127, |
||||
"DEFAULT_FILL_INT16" : -32767, |
||||
"DEFAULT_FILL_INT32" : -2147483647, |
||||
"DEFAULT_FILL_INT64" : -9223372036854775806, |
||||
"DEFAULT_FILL_FLOAT" : 9.9692099683868690E36, |
||||
"DEFAULT_FILL_DOUBLE" : 9.9692099683868690E36, |
||||
"fomp_sched_static" : 1, |
||||
"fomp_sched_dynamic" : 2, |
||||
"fomp_sched_guided" : 3, |
||||
"fomp_sched_auto" : 4} |
||||
|
||||
class MockWrfConstants(object): |
||||
def __init__(self): |
||||
self.__dict__ = consts |
||||
|
||||
def mock_asscalar(val): |
||||
return float(val) |
||||
|
||||
sys.modules["wrf._wrffortran"].wrf_constants = MockWrfConstants() |
||||
sys.modules["wrf._wrffortran"].omp_constants = MockWrfConstants() |
||||
|
||||
sys.modules["numpy"].asscalar = mock_asscalar |
||||
|
||||
import wrf |
||||
print (wrf.get_coord_pairs.__doc__) |
@ -0,0 +1,77 @@
@@ -0,0 +1,77 @@
|
||||
import unittest as ut |
||||
import numpy.testing as nt |
||||
import numpy as np |
||||
import numpy.ma as ma |
||||
import os, sys |
||||
import subprocess |
||||
|
||||
from wrf import getvar, ALL_TIMES |
||||
|
||||
TEST_DIR = "/Users/ladwig/Documents/wrf_files/wrf_vortex_multi" |
||||
TEST_FILENAMES = ["wrfout_d02_2005-08-28_00:00:00", |
||||
"wrfout_d02_2005-08-28_12:00:00", |
||||
"wrfout_d02_2005-08-29_00:00:00"] |
||||
TEST_FILES = [os.path.join(TEST_DIR, x) for x in TEST_FILENAMES] |
||||
|
||||
# Python 3 |
||||
if sys.version_info > (3,): |
||||
xrange = range |
||||
|
||||
|
||||
class WRFFileVarsTest(ut.TestCase): |
||||
longMessage = True |
||||
|
||||
def make_test(ncfiles, varname): |
||||
def test(self): |
||||
#import time |
||||
#very_start = time.time() |
||||
#start = time.time() |
||||
t1 = getvar(ncfiles, varname, 0) |
||||
|
||||
#end = time.time() |
||||
#print ("t1: ", start-end) |
||||
#start = time.time() |
||||
t2 = getvar(ncfiles, varname, 0, meta=False) |
||||
#end = time.time() |
||||
#print ("t2: ", start-end) |
||||
#start = time.time() |
||||
t3 = getvar(ncfiles, varname, ALL_TIMES) |
||||
#end = time.time() |
||||
#print ("t3: ", start-end) |
||||
#start = time.time() |
||||
t4 = getvar(ncfiles, varname, ALL_TIMES, meta=False) |
||||
#end = time.time() |
||||
#print ("t4: ", start-end) |
||||
#start = time.time() |
||||
t5 = getvar(ncfiles, varname, ALL_TIMES, method="join") |
||||
#end = time.time() |
||||
#print ("t5: ", start-end) |
||||
#start = time.time() |
||||
t6 = getvar(ncfiles, varname, ALL_TIMES, method="join", meta=False) |
||||
#end = time.time() |
||||
#print ("t6: ", start-end) |
||||
#start = time.time() |
||||
|
||||
#print ("Total Time: ", (end-start)) |
||||
return test |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
from netCDF4 import Dataset |
||||
ncfiles = [Dataset(x) for x in TEST_FILES] |
||||
|
||||
#import scipy.io |
||||
#ncfiles = [scipy.io.netcdf.netcdf_file(x) for x in TEST_FILES] |
||||
|
||||
file_vars = ncfiles[0].variables.keys() |
||||
|
||||
ignore_vars = [] |
||||
|
||||
for var in file_vars: |
||||
if var in ignore_vars: |
||||
continue |
||||
|
||||
test_func1 = make_test(ncfiles, var) |
||||
setattr(WRFFileVarsTest, 'test_{0}'.format(var), test_func1) |
||||
|
||||
ut.main() |
@ -0,0 +1,122 @@
@@ -0,0 +1,122 @@
|
||||
from __future__ import (absolute_import, division, print_function, |
||||
unicode_literals) |
||||
|
||||
import unittest as ut |
||||
import numpy.testing as nt |
||||
|
||||
from wrf import (omp_set_num_threads, omp_get_num_threads, |
||||
omp_get_max_threads, omp_get_thread_num, |
||||
omp_get_num_procs, omp_in_parallel, |
||||
omp_set_dynamic, omp_get_dynamic, omp_set_nested, |
||||
omp_get_nested, omp_set_schedule, |
||||
omp_get_schedule, omp_get_thread_limit, |
||||
omp_set_max_active_levels, |
||||
omp_get_max_active_levels, omp_get_level, |
||||
omp_get_ancestor_thread_num, omp_get_team_size, |
||||
omp_get_active_level, omp_in_final, |
||||
omp_init_lock, omp_init_nest_lock, |
||||
omp_destroy_lock, omp_destroy_nest_lock, |
||||
omp_set_lock, omp_set_nest_lock, |
||||
omp_unset_lock, omp_unset_nest_lock, |
||||
omp_test_lock, omp_test_nest_lock, |
||||
omp_get_wtime, omp_get_wtick, |
||||
OMP_SCHED_STATIC, OMP_SCHED_DYNAMIC, |
||||
OMP_SCHED_GUIDED, OMP_SCHED_AUTO) |
||||
|
||||
|
||||
class OmpTest(ut.TestCase): |
||||
longMessage = True |
||||
|
||||
def test_locks(self): |
||||
l = omp_init_lock() |
||||
omp_set_lock(l) |
||||
omp_unset_lock(l) |
||||
omp_test_lock(l) |
||||
omp_destroy_lock(l) |
||||
|
||||
nl = omp_init_nest_lock() |
||||
omp_set_nest_lock(nl) |
||||
omp_unset_nest_lock(nl) |
||||
omp_test_nest_lock(nl) |
||||
omp_destroy_nest_lock(nl) |
||||
|
||||
|
||||
def test_thread_set(self): |
||||
omp_set_num_threads(4) |
||||
max_threads = omp_get_max_threads() |
||||
self.assertEqual(max_threads, 4) |
||||
|
||||
num_threads = omp_get_num_threads() |
||||
self.assertEqual(num_threads, 1) # Always 1 outside of parallel region |
||||
|
||||
thread_num = omp_get_thread_num() |
||||
self.assertEqual(thread_num, 0) # Always 0 outside of parallel region |
||||
num_procs = omp_get_num_procs() |
||||
in_parallel = omp_in_parallel() |
||||
self.assertFalse(in_parallel) # Always False outside of parallel region |
||||
|
||||
limit = omp_get_thread_limit() |
||||
|
||||
|
||||
def test_dynamic(self): |
||||
omp_set_dynamic(True) |
||||
dynamic = omp_get_dynamic() |
||||
self.assertTrue(dynamic) |
||||
|
||||
omp_set_dynamic(False) |
||||
dynamic = omp_get_dynamic() |
||||
self.assertFalse(dynamic) |
||||
|
||||
def test_nested(self): |
||||
omp_set_nested(True) |
||||
nested = omp_get_nested() |
||||
self.assertTrue(nested) |
||||
|
||||
omp_set_nested(False) |
||||
nested = omp_get_nested() |
||||
self.assertFalse(nested) |
||||
|
||||
|
||||
def test_schedule(self): |
||||
omp_set_schedule(OMP_SCHED_STATIC, 100000) |
||||
kind, modifier = omp_get_schedule() |
||||
self.assertEqual(kind, OMP_SCHED_STATIC) |
||||
self.assertEqual(modifier, 100000) |
||||
|
||||
omp_set_schedule(OMP_SCHED_DYNAMIC, 10000) |
||||
kind, modifier = omp_get_schedule() |
||||
self.assertEqual(kind, OMP_SCHED_DYNAMIC) |
||||
self.assertEqual(modifier, 10000) |
||||
|
||||
omp_set_schedule(OMP_SCHED_GUIDED, 100) |
||||
kind, modifier = omp_get_schedule() |
||||
self.assertEqual(kind, OMP_SCHED_GUIDED) |
||||
self.assertEqual(modifier, 100) |
||||
|
||||
omp_set_schedule(OMP_SCHED_AUTO, 10) |
||||
kind, modifier = omp_get_schedule() |
||||
self.assertEqual(kind, OMP_SCHED_AUTO) |
||||
self.assertNotEqual(modifier, 10) # The modifier argument is ignored, |
||||
# so it will be set to the previous |
||||
# value of 100. |
||||
|
||||
|
||||
def test_team_level(self): |
||||
omp_set_max_active_levels(10) |
||||
active_levels = omp_get_max_active_levels() |
||||
self.assertEqual(active_levels, 10) |
||||
|
||||
level = omp_get_level() |
||||
ancestor_thread = omp_get_ancestor_thread_num(level) |
||||
team_size = omp_get_team_size(level) |
||||
active_level = omp_get_active_level() |
||||
in_final = omp_in_final() |
||||
|
||||
|
||||
def test_time(self): |
||||
wtime = omp_get_wtime() |
||||
wtick = omp_get_wtick() |
||||
|
||||
if __name__ == "__main__": |
||||
ut.main() |
||||
|
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
from __future__ import print_function |
||||
|
||||
import time |
||||
from netCDF4 import Dataset |
||||
from wrf import getvar, ALL_TIMES, extract_vars |
||||
|
||||
wrf_filenames = ["/Users/ladwig/Documents/wrf_files/wrf_vortex_multi/wrfout_d02_2005-08-28_00:00:00", |
||||
"/Users/ladwig/Documents/wrf_files/wrf_vortex_multi/wrfout_d02_2005-08-28_12:00:00", |
||||
"/Users/ladwig/Documents/wrf_files/wrf_vortex_multi/wrfout_d02_2005-08-29_00:00:00"] |
||||
|
||||
wrfin = [Dataset(x) for x in wrf_filenames] |
||||
|
||||
my_cache = extract_vars(wrfin, ALL_TIMES, ("P", "PB", "PH", "PHB", "T", "QVAPOR", "HGT", "U", "V", "W", "PSFC")) |
||||
|
||||
start = time.time() |
||||
for var in ("avo", "eth", "cape_2d", "cape_3d", "ctt", "dbz", "mdbz", |
||||
"geopt", "helicity", "lat", "lon", "omg", "p", "pressure", |
||||
"pvo", "pw", "rh2", "rh", "slp", "ter", "td2", "td", "tc", |
||||
"theta", "tk", "tv", "twb", "updraft_helicity", "ua", "va", |
||||
"wa", "uvmet10", "uvmet", "z", "cfrac", "zstag", "geopt_stag"): |
||||
v = getvar(wrfin, var, ALL_TIMES) |
||||
end = time.time() |
||||
|
||||
print ("Time taken without variable cache: ", (end-start)) |
||||
|
||||
start = time.time() |
||||
for var in ("avo", "eth", "cape_2d", "cape_3d", "ctt", "dbz", "mdbz", |
||||
"geopt", "helicity", "lat", "lon", "omg", "p", "pressure", |
||||
"pvo", "pw", "rh2", "rh", "slp", "ter", "td2", "td", "tc", |
||||
"theta", "tk", "tv", "twb", "updraft_helicity", "ua", "va", |
||||
"wa", "uvmet10", "uvmet", "z", "cfrac", "zstag", "geopt_stag"): |
||||
v = getvar(wrfin, var, ALL_TIMES, cache=my_cache) |
||||
end = time.time() |
||||
|
||||
print ("Time taken with variable cache: ", (end-start)) |
||||
|
Loading…
Reference in new issue