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 fixed zlevels to other weather models ie non ECMWF #320

Merged
merged 3 commits into from
Sep 21, 2021
Merged
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
5 changes: 5 additions & 0 deletions tools/RAiDER/models/gmao.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
from RAiDER.models.weatherModel import WeatherModel
from RAiDER.logger import *
from RAiDER.utilFcns import writeWeatherVars2NETCDF4, roundTime, requests_retry_session
from RAiDER.models.model_levels import (
LEVELS_137_HEIGHTS,
)


class GMAO(WeatherModel):
Expand Down Expand Up @@ -41,6 +44,8 @@ def __init__(self):
self._x_res = 0.3125
self._y_res = 0.25

self._zlevels = np.flipud(LEVELS_137_HEIGHTS)

self._Name = 'GMAO'
self.files = None
self._bounds = None
Expand Down
5 changes: 5 additions & 0 deletions tools/RAiDER/models/hrrr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

from RAiDER.logger import *
from RAiDER.models.weatherModel import WeatherModel
from RAiDER.models.model_levels import (
LEVELS_137_HEIGHTS,
)


class HRRR(WeatherModel):
Expand Down Expand Up @@ -40,6 +43,7 @@ def __init__(self):
self._Npl = 0
self.files = None
self._bounds = None
self._zlevels = np.flipud(LEVELS_137_HEIGHTS)

# Projection
# See https://github.com/blaylockbk/pyBKB_v2/blob/master/demos/HRRR_earthRelative_vs_gridRelative_winds.ipynb and code lower down
Expand All @@ -56,6 +60,7 @@ def __init__(self):
p1 = CRS('+proj=lcc +lat_1={lat1} +lat_2={lat2} +lat_0={lat0} +lon_0={lon0} +x_0={x0} +y_0={y0} +a={a} +b={a} +units=m +no_defs'.format(lat1=lat1, lat2=lat2, lat0=lat0, lon0=lon0, x0=x0, y0=y0, a=earth_radius))
self._proj = p1


def _fetch(self, lats, lons, time, out, Nextra=2):
'''
Fetch weather model data from HRRR
Expand Down
4 changes: 4 additions & 0 deletions tools/RAiDER/models/merra2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
from RAiDER.models.weatherModel import WeatherModel
from RAiDER.logger import *
from RAiDER.utilFcns import writeWeatherVars2NETCDF4
from RAiDER.models.model_levels import (
LEVELS_137_HEIGHTS,
)


def Model():
Expand Down Expand Up @@ -54,6 +57,7 @@ def __init__(self):
self._Name = 'MERRA2'
self.files = None
self._bounds = None
self._zlevels = np.flipud(LEVELS_137_HEIGHTS)

# Projection
self._proj = CRS.from_epsg(4326)
Expand Down
5 changes: 5 additions & 0 deletions tools/RAiDER/models/ncmr.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
read_NCMR_loginInfo,
show_progress
)
from RAiDER.models.model_levels import (
LEVELS_137_HEIGHTS,
)


class NCMR(WeatherModel):
Expand Down Expand Up @@ -52,6 +55,8 @@ def __init__(self):
self._x_res = .17578125 # same as longitude
self._y_res = .11718750 # same as latitude

self._zlevels = np.flipud(LEVELS_137_HEIGHTS)

self._bounds = None

# Projection
Expand Down
6 changes: 6 additions & 0 deletions tools/RAiDER/models/template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from RAiDER.models.weatherModel import WeatherModel
from RAiDER.models.model_levels import (
LEVELS_137_HEIGHTS,
)


class customModelReader(WeatherModel):
Expand Down Expand Up @@ -29,6 +32,9 @@ def __init__(self):
self._y_res = 3. # y-direction grid spacing in the weather model native projection
# (if the projection is in lat/lon, it is the same as "self._lat_res")

# zlevels specify fixed heights at which to interpolate the weather model variables
self._zlevels = np.flipud(LEVELS_137_HEIGHTS)

self._Name = 'ABCD' # name of the custom weather model (better to be capitalized)

# Projections in RAiDER are defined using pyproj (python wrapper around Proj)
Expand Down