A collection of scripts for facilitating the usage of ERF.
from erftools.preprocessing import WRFInputDeck
wrf = WRFInputDeck('namelist.input')
wrf.process_initial_conditions('wrfinput_d01',
landuse_table_path='/Users/equon/WRF/run/LANDUSE.TBL',
write_hgt='terrain_height.txt',
write_z0='roughness_height.txt')
wrf.write_inputfile('inputs')
Data logs are output with the erf.data_log
param and can include time histories of surface conditions and planar averaged profiles (e.g., for idealized LES simulations)
from erftools.postprocessing import DataLog
log = DataLog(f'{simdir}/surf_hist.dat',
f'{simdir}/mean_profiles.dat',
f'{simdir}/flux_profiles.dat',
f'{simdir}/sfs_profiles.dat')
log.calc_stress()
log.est_abl_height('max_theta_grad')
print(log.ds) # data are stored in an xarray dataset
Some notes and recommendations:
- An aspirational goal is to contribute code that can be used as in the examples above, with clear, intuitive naming and following PEP-8 style as a set of guidelines rather than gospel.
- To avoid duplication, model constants are defined in
erf.constants
, which should replicateERF/Source/ERF_Constants.H
. - In the same vein, equation of state evaluations are defined in
erf.EOS
, which should replicateERF/Source/Utils/ERF_EOS.H
.