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

Create class to generate idealized soundings from real data #2

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions erftools/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,24 @@ def mapfun(idx):
self.erf_input['erf.most.z0'] = z0mean


class RealSounding(object):
"""Class to extract soundings from WPS output"""

def __init__(self,met_em_path):
self.load_met_em(met_em_path)

def load_met_em(self,fpath):
ds = xr.open_dataset(fpath)
self.U = ds['UU'] # staggered in west_east dir [m/s]
self.V = ds['VV'] # staggered in south_north dir [m/s]
self.P = ds['PRES'] # unstaggered [Pa]
self.T = ds['TT'] # unstaggered [K]
self.RH = ds['RH'] # unstaggered [%]
# see https://github.com/a2e-mmc/mmctools/blob/master/mmctools/helper_functions.py#L104
# for calculating vapor mixing ratio
# see https://github.com/a2e-mmc/mmctools/blob/master/mmctools/helper_functions.py#L76
# for calculating virtual temperature (to get virtual potential temperature)

def write(self,soundingfile):
print('Wrote',soundingfile)