diff --git a/tools/RAiDER/models/ecmwf.py b/tools/RAiDER/models/ecmwf.py index 239dfc7fc..7f6efa5e2 100755 --- a/tools/RAiDER/models/ecmwf.py +++ b/tools/RAiDER/models/ecmwf.py @@ -13,6 +13,7 @@ LEVELS_25_HEIGHTS, A_137_HRES, B_137_HRES, + LEVELS_50_HEIGHTS, ) from RAiDER.models.weatherModel import WeatherModel, TIME_RES @@ -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 @@ -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