forked from JCSDA-internal/eva
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow missing/empty cycle time files in timeseries (JCSDA-internal#211)
## Description - Added support for missing/empty cycle time files when running in timeseries mode - Adding requirements that work on discover milan nodes ## Demonstration Comparing two time series of different lengths: ![time_series_omb](https://github.com/user-attachments/assets/0b91a062-28a3-4bb2-ae0d-6aa8d919abfe) Timeseries with a missing cycle time: ![time_series_omb](https://github.com/user-attachments/assets/d97dd883-7f62-410d-a8f7-31e30edc4eb5)
- Loading branch information
Showing
9 changed files
with
161 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
setuptools>=59.4.0 | ||
pyyaml>=6.0 | ||
pycodestyle>=2.8.0 | ||
netCDF4 | ||
matplotlib | ||
cartopy>=0.21.1 | ||
scipy>=1.9.3 | ||
xarray>=2022.3.0 | ||
pandas>=1.4.0 | ||
numpy==1.22.3 | ||
|
||
# Not explicitly part of eva but dependcies of eva dependencies already in spack-stack | ||
# versions need to be set to avoid other versions being picked | ||
pyproj | ||
importlib-metadata==4.8.2 | ||
contourpy==1.0.7 | ||
|
||
# Additional packages | ||
git+https://github.com/NOAA-EMC/emcpy.git@f7b863d9508b921a78d7ff0e53de0b95e9a176f7#egg=emcpy | ||
scikit-learn | ||
seaborn | ||
hvplot | ||
nbconvert | ||
bokeh | ||
geopandas | ||
geoviews |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
setuptools>=59.4.0 | ||
pyyaml>=6.0 | ||
pycodestyle>=2.8.0 | ||
netCDF4 | ||
matplotlib | ||
cartopy>=0.21.1 | ||
scipy>=1.9.3 | ||
xarray>=2022.3.0 | ||
pandas>=1.4.0 | ||
numpy==1.22.3 | ||
attrs==21.4.0 | ||
|
||
# Not explicitly part of eva but dependcies of eva dependencies already in spack-stack | ||
# versions need to be set to avoid other versions being picked | ||
pyproj | ||
importlib_metadata==7.1.0 | ||
contourpy==1.0.7 | ||
msgpack>=1.0.0 | ||
|
||
# Additional packages | ||
git+https://github.com/NOAA-EMC/emcpy.git@f7b863d9508b921a78d7ff0e53de0b95e9a176f7#egg=emcpy | ||
scikit-learn | ||
seaborn | ||
hvplot | ||
nbconvert | ||
bokeh | ||
geopandas | ||
geoviews |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import os | ||
import numpy as np | ||
import xarray as xr | ||
from eva.data.data_driver import data_driver | ||
from eva.data.data_collections import DataCollections | ||
|
||
|
||
filename_retrieval = { | ||
"IodaObsSpace": lambda dataset_config: dataset_config["filenames"][0], | ||
"JediVariationalBiasCorrection": lambda dataset_config: dataset_config["bias_file"], | ||
} | ||
|
||
|
||
def get_filename(dataset_config, logger): | ||
""" Retrieve filename using given type """ | ||
|
||
dataset_type = dataset_config["type"] | ||
logger.assert_abort(dataset_type in filename_retrieval, | ||
f'Unknown dataset_type {dataset_type}') | ||
filename = filename_retrieval[dataset_type](dataset_config) | ||
return filename | ||
|
||
|
||
def check_file(filename, logger): | ||
""" Check if first file exists and is nonzero """ | ||
|
||
if not os.path.isfile(filename): | ||
logger.abort('First file provided to timeseries must exist.') | ||
elif os.stat(filename).st_size == 0: | ||
logger.abort('First file provided to timeseries must be nonzero.') | ||
|
||
|
||
def create_empty_data(timeseries_config, dataset_config, timing, logger): | ||
""" Creating an empty data collection to use for missing cycle times """ | ||
|
||
dc_tmp = DataCollections() | ||
collection = timeseries_config["collection"] | ||
data_driver(dataset_config, dc_tmp, timing, logger) | ||
dataset = dc_tmp.get_data_collection(collection) | ||
empty_data = xr.full_like(dataset, np.nan) | ||
dc = DataCollections() | ||
dc.create_or_add_to_collection(collection, empty_data) | ||
return dc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters