Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New/improved dataclasses for WRFInputDeck, ERFInputs; automate WRF-->ERF inputs #24

Open
wants to merge 73 commits into
base: main
Choose a base branch
from

Conversation

ewquon
Copy link
Contributor

@ewquon ewquon commented Jan 9, 2025

ERFInputs dataclass can be used load, standardize, compare, and output existing ERF input files. The most widely used inputs from https://erf.readthedocs.io/en/latest/Inputs.html have been included.

The WRFInputDeck class has been revamped and uses ERFInputs to automate the conversion of WRF inputs to ERF inputs. Example usage:

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')

Screen output:

INFO: Assuming all domains have the same start/end datetime as level 0
INFO: Total simulation time: 302400.0
INFO: Start from 2021-08-20 12:00:00 (1629460800 seconds since epoch)
INFO: Stop at 2021-08-24 00:00:00 (1629763200 seconds since epoch)
INFO: Estimated domain ztop from domains.p_top_requested=5000 : 19900.94357309304
INFO: Domain SW corner is (0,0)
WARNING: Applying numerical diffusion on all levels, with erf.num_diff_coeff=0.12 -- this can have unexpected effects in ERF
INFO: Using mean XLAT=30.09653091430664 (projection CEN_LAT=30.829988479614258)
INFO: Earth rotational period from Coriolis param : 23.934878472222223 h
Writing out terrain_height.txt
Writing out roughness_height.txt
Wrote inputs

Current limitations:

  • Mappings between WRF options and ERF options need to be actively maintained (in erftools.wrf.namelist_mappings)
  • To produce valid ERF inputs, surface layer options map to "MOST" and most microphysics options map to "SAM"
  • Placeholder for radiation has been included: erf.radiation_model = RRTMGP; nothing for the land-surface model yet
  • This generates a terrain and (static) roughness maps from an existing wrfinput file; if unavailable, Coriolis params (const) and terrain height/roughness (const or surface maps) may be manually specified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant