Skip to content
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)