Usage
An overview of scahpy
capabilities will be displayed.
Importing the Package
To import all the modules in scahpy
we can use the *
cd as for example:
from scahpy import *
To import specific modules from the package, we can specify their names:
from scahpy import in_out, met_vars
Reading WRF outputs files
The WRF model can generate outputs either with one time per file or multiple times in a single file. scahpy
is capable of handling both scenarios. For reading multiple wrfout files, you can utilize the read_wrf_multi
function, while for reading a single file, you can use the read_wrf_single
function.
# Example: Reading and processing multiple WRF datasets
= in_out._drop_vars('/datos/wrfout_d01_2024-01-01_03:00:00',['RAINC', 'RAINNC', 'RAINSH', 'U10', 'V10', 'SSTSK'], model='wrf')
sfc = sorted(glob.glob('/datos/wrfout_d01*'))
files = in_out.read_wrf_multi(files, sfc, '5 hours', -1) ds
Calculating Precipitation
scahpy
has a module called met_vars
designed specifically for calculating various diagnostic variables, such as precipitation, using the calc_pp
function.
# Example: Calculating precipitation using diagnostics module
= met_vars.calc_pp(ds,vars_to_sum=['RAINC', 'RAINNC', 'RAINSH'],True) ds2