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

add truncation option for HRES comparing with HRRR #589

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Fixes
* For s1-azimuth-time interpolation, overlapping orbits when one orbit does not cover entire GUNW product errors out. We now ensure state-vectors are both unique and in order before creating a orbit object in ISCE3.
* Use single date when center_time is specified and requested occurs on model hour

## [0.4.3]
+ Prevent ray tracing integration from occuring at exactly top of weather model
Expand Down
10 changes: 10 additions & 0 deletions tools/RAiDER/cli/raider.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,16 @@ def calcDelays(iargs=None):
elif (interp_method == 'none') and (len(wfiles) == 1) and (len(times) == 1):
weather_model_file = wfiles[0]

elif (interp_method == 'center_time') and (len(wfiles) == 1) and (len(times) == 1):
## check if requested time is coincident with model time
valid_hours = np.arange(0, 24, model._time_res)
if model._time.hour in valid_hours:
weather_model_file = wfiles[0]
else:
n = len(wfiles)
raise NotImplementedError(f'The center_time with {n} retrieved weather model files was not well posed '
'for the dela current workflow.')

# only one time in temporal interpolation worked
# TODO: this seems problematic - unexpected behavior possibly for 'center_time'
elif len(wfiles)==1 and len(times)==2:
Expand Down
8 changes: 7 additions & 1 deletion tools/RAiDER/delay.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,18 @@ def tropo_delay(
else:
height_levels = wm_levels

if isinstance(zref, str):
try:
zref = float(zref)
except:
log.warning('Cannot convert zref={%s} to a number', zref)

if not zref:
zref = toa

if zref > toa:
zref = toa
logger.warning('Requested integration height (zref) is higher than top of weather model. Forcing to top ({toa}).')
logger.warning(f'Requested integration height (zref) is higher than top of weather model. Forcing to top ({toa}).')


#TODO: expose this as library function
Expand Down
27 changes: 27 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,33 @@ def _load_model_level(self, fname):

self._t = t
self._q = q

# reset the model levels to allow truncation to work with temporal interpolation
self.__model_levels__()
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 +388,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
5 changes: 0 additions & 5 deletions tools/RAiDER/processWM.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ def prepareWeatherModel(
f = weather_model.load()

if f is not None:
logger.warning(
'The processed weather model file already exists,'
' so I will use that.'
)

containment = weather_model.checkContainment(ll_bounds)
if not containment and weather_model.Model() in 'GMAO ERA5 ERA5T HRES'.split():
msg = 'The weather model passed does not cover all of the input ' \
Expand Down
Loading