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

Globsim 4.0 #149

Merged
merged 31 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e6f0c0b
fix ERA5 with new libraries (renamed netcdf only)
nicholas512 Aug 15, 2024
7a78b9f
add properties to access variable names 'time' and 'level'
nicholas512 Aug 15, 2024
a3876af
working with new ERA5 spec
nicholas512 Aug 16, 2024
7e60c60
update tests for newer python versions
nicholas512 Aug 16, 2024
10db626
clean up legacy content
nicholas512 Aug 16, 2024
923cb25
update JRA (works)
nicholas512 Aug 16, 2024
bc3f6cd
updated MERRA (works)
nicholas512 Aug 16, 2024
370c997
update dods function for new library version
nicholas512 Aug 16, 2024
67c14d3
(4.0.0) update version
nicholas512 Aug 16, 2024
79d96d2
update dependencies
nicholas512 Aug 16, 2024
452c41f
update tests
nicholas512 Aug 16, 2024
0aba7f8
install setuptools in build tests
nicholas512 Aug 16, 2024
b9b06dd
pydap 3.4.1 required
nicholas512 Aug 20, 2024
6cd38d4
progress on JRA
nicholas512 Aug 23, 2024
6071b79
remove old ESMF checks
nicholas512 Aug 23, 2024
0bd04e8
misc era5
nicholas512 Aug 23, 2024
57df464
JRA3Q download
nicholas512 Aug 26, 2024
c87e1af
use sizes() not dims() to get dim names
nicholas512 Aug 26, 2024
40a7587
check completed files for era5
nicholas512 Aug 26, 2024
41ee7a7
add additional rdams file for now
nicholas512 Aug 26, 2024
e89b855
fix JRA TUNIts
nicholas512 Aug 26, 2024
a1aa5b3
JRA3Q working
nicholas512 Aug 26, 2024
f519288
clean up RDA files
nicholas512 Aug 26, 2024
1930de0
remove old file
nicholas512 Aug 26, 2024
3137920
delete old file
nicholas512 Aug 26, 2024
cff3577
delete old file
nicholas512 Aug 26, 2024
7efe2be
add support for J3Q gaussian grid
nicholas512 Aug 27, 2024
b0aa304
add dask dependency
nicholas512 Aug 27, 2024
49c4217
allow resume of partially completed interpolation
nicholas512 Aug 27, 2024
d255458
allow missing files when checking resume compatibility
nicholas512 Aug 27, 2024
e24092f
ensure 0 <= WD < 360
nicholas512 Aug 27, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.11,3.12]

steps:
- uses: actions/checkout@v2
Expand All @@ -34,6 +34,7 @@ jobs:
sudo apt-get install libhdf5-serial-dev netcdf-bin libnetcdf-dev
python -m pip install --upgrade pip
pip install flake8
python -m pip install setuptools
python -m pip install -r requirements.txt
python -m pip install pygrib
python -m pip install xarray
Expand Down
2 changes: 1 addition & 1 deletion globsim/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "3.9.3"
__version__ = "4.0.0"


53 changes: 44 additions & 9 deletions globsim/boundingbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,51 @@ def stations_bbox(stations) -> BoundingBox:


def netcdf_bbox(ncf: "Union[str, nc.Dataset]") -> BoundingBox:

if isinstance(ncf, str):
ncf = nc.Dataset(ncf)
if isinstance(ncf, nc.Dataset):
x,y = _nc_get_lat_lon(ncf)
xval = x[:]
yval = y[:]

else: # XARRAY
x,y = _xr_get_lat_lon(ncf)
xval = x.values
yval = y.values

bbx = BoundingBox(np.min(xval), np.max(xval), np.min(yval), np.max(yval))

return bbx


def _xr_get_lat_lon(xrf):
# TODO: implement this
return xrf['longitude'], xrf['latitude']

x = xrf.filter_by_attrs(axis='X')
if not x:
x = xrf.filter_by_attrs(standard_name='longitude')
if not x:
x = xrf.filter_by_attrs(long_name='longitude')
if not x:
x = xrf['longitude'] if 'longitude' in xrf.coords else None
if not x:
raise KeyError("Could not find x-coordinate")

y = xrf.filter_by_attrs(axis='Y')
if not y:
y = xrf.filter_by_attrs(standard_name='latitude')
if not y:
y = xrf.filter_by_attrs(long_name='latitude')
if not y:
y = xrf['latitude'] if 'latitude' in xrf.coords else None
if not y:
raise KeyError("Could not find y-coordinate")

return x, y

def _nc_get_lat_lon(ncf):
x = ncf.get_variables_by_attributes(axis='X')
if not x:
x = ncf.get_variables_by_attributes(standard_name='longitude')
Expand All @@ -84,15 +126,8 @@ def netcdf_bbox(ncf: "Union[str, nc.Dataset]") -> BoundingBox:
y = ncf['latitude'] if 'latitude' in ncf.variables else None
if not y:
raise KeyError("Could not find y-coordinate")

xval = x[:]
yval = y[:]

bbx = BoundingBox(np.min(xval), np.max(xval), np.min(yval), np.max(yval))

return bbx



return x,y
"""

from collections import namedtuple
Expand Down
6 changes: 3 additions & 3 deletions globsim/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def variables_skip(variable_name):
Which variable names to use? Drop the ones that are dimensions.
"""
skip = 0
dims = ('time', 'number', 'level',
'latitude', 'longitude', 'station', 'height')
dims = ('time', 'number', 'level','valid_time', 'pressure_level','expver',
'latitude', 'longitude', 'station', 'height', 'skip')
if variable_name in dims:
skip = 1
return skip
Expand Down Expand Up @@ -153,7 +153,6 @@ def create_globsim_directory(target_dir, name):
mkdir(TL)

# create subdirectories
mkdir(path.join(TL, "eraint"))
mkdir(path.join(TL, "Grib"))
mkdir(path.join(TL, "jra55"))
mkdir(path.join(TL, "merra2"))
Expand Down Expand Up @@ -204,3 +203,4 @@ def get_begin_date(par, data_folder, match_strings):

print("Found some files in directory. Beginning download on {}".format(begin_date.strftime("%Y-%m-%d")))
return(begin_date)

Loading
Loading