Skip to content

Commit

Permalink
add truncation option for HRES comparing with HRRR
Browse files Browse the repository at this point in the history
  • Loading branch information
bbuzz31 committed Sep 2, 2023
1 parent 61e0c91 commit f80b032
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tools/RAiDER/models/ecmwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
LEVELS_25_HEIGHTS,
A_137_HRES,
B_137_HRES,
LEVELS_50_HEIGHTS,
)

from RAiDER.models.weatherModel import WeatherModel, TIME_RES
Expand Down Expand Up @@ -92,8 +93,31 @@ def _load_model_level(self, fname):

self._t = t
self._q = q

geo_hgt, pres, hgt = self._calculategeoh(z, lnsp)

TRUNCATE = True
if TRUNCATE:
# now edit all the variables
logger.info('Truncating weather model heights')

## BB HACK FOR COMPARING HRES TO HRRR
self._levels = 50
self._zlevels = np.flipud(LEVELS_50_HEIGHTS)
# this is the index to 26053.04 LEVELS_137_HEIGHTS
# which is the closest highest level to HRRR
# we will only take the variables up to this height from the weather model
# and then interpolate to LEVELS_50_HEIGHTS to match HRRR
self._mlixU = 36 # this is the index if your starting at the highest
self._mlixD = 109 # careful [:109] is corrrect

self._t = self._t[:self._mlixD]
self._q = self._q[:self._mlixD]
geo_hgt = geo_hgt[:self._mlixD]
pres = pres[:self._mlixD]
hgt = hgt[:self._mlixD]


self._lons, self._lats = np.meshgrid(lons, lats)

# ys is latitude
Expand Down Expand Up @@ -362,4 +386,5 @@ def _makeDataCubes(self, fname, verbose=False):
raise RuntimeError('There is no data in z, '
'you may have a problem with your mask')


return lats, lons, xs, ys, t, q, lnsp, z

0 comments on commit f80b032

Please sign in to comment.