-
Notifications
You must be signed in to change notification settings - Fork 1
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
Cut new version #30
Merged
Merged
Cut new version #30
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ff0cffe
HRRR - FileLoader - Remove forecast_flag parameter.
jomey 59d3d0e
HRRR - Deprecate the HRRR class in favor of data.hrrr.
jomey 3748291
Remove examples folder.
jomey 7eef144
Tests - Remove OpenDAP test - Was marked to skip.
jomey e77b0c9
Tests - Move RME test base class to corresponding RME folder.
jomey 7e3826e
HRRR - Deprecate utils method to get a file name.
jomey 30fff0c
HRRR - FileLoader - Rename parameter in 'get_saved_data' method.
jomey cb105e6
HRRR - FileLoader - Remove duplicate property initialization.
jomey 1e1b175
HRRR - FileLoader - Consolidate logic to convert to dataframe.
jomey 627415d
HRRR - FileLoader - Update method documentation.
jomey 87c6a4d
HRRR - FileLoader - Further refine the parameters.
jomey fa90008
HRRR - ConfigFile - Improve checking for config entries presence.
jomey 33cab7c
HRRR - ConfigFile - Refactor config_file parameter.
jomey ae0ad6d
HRRR - FileLoader - Pass the logger to the file loader.
jomey 22bb95e
Tests - turn down the noise level a bit and seg lot to ERROR.
jomey 56e8e4e
Address lint errors.
jomey 23d6344
HRRR - ConfigFile - improve logger handling.
jomey 03377a0
Utils - read_config - Drop check for Python version.
jomey File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
from .RME_test_case import RMETestCase | ||
|
||
__all__ = [ | ||
RMETestCase | ||
] |
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,55 @@ | ||
import numpy as np | ||
import pandas as pd | ||
|
||
from tests.RME import RMETestCase | ||
from weather_forecast_retrieval.data.hrrr import FileLoader | ||
|
||
|
||
def compare_gold(v_name, gold_dir, test_df): | ||
""" | ||
Compare against gold HRRR data stored as csv in basin directory. | ||
|
||
Args: | ||
v_name: Variable to compare that also serves as the file name to load. | ||
gold_dir: Directory containing gold standard results | ||
test_df: Data frame containing test results to be compared | ||
""" | ||
|
||
df_gold = pd.read_csv( | ||
gold_dir.joinpath(v_name+'_data.csv').as_posix(), | ||
header=0, | ||
delimiter=',', | ||
parse_dates=['date_time'], | ||
index_col='date_time', | ||
dtype=np.float32, | ||
) | ||
|
||
np.testing.assert_allclose(test_df.values, df_gold.values, rtol=1e-4) | ||
|
||
|
||
class TestHRRR(RMETestCase): | ||
def testHRRRGribLoad(self): | ||
""" | ||
Load HRRR data from multiple grib files | ||
""" | ||
metadata, data = FileLoader().get_saved_data( | ||
self.START_DATE, | ||
self.END_DATE, | ||
self.BBOX, | ||
file_type='grib2', | ||
file_dir=self.hrrr_dir.as_posix(), | ||
force_zone_number=self.UTM_ZONE_NUMBER | ||
) | ||
|
||
df = pd.read_csv( | ||
self.gold_dir.joinpath('metadata.csv').as_posix(), | ||
header=0, | ||
index_col='grid' | ||
) | ||
|
||
self.assertIsNotNone(metadata) | ||
np.testing.assert_allclose( | ||
df.values, metadata[df.columns].values, rtol=1e-4 | ||
) | ||
|
||
[compare_gold(k, self.gold_dir, df) for k, df in data.items()] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain moving this file? It seems to go against how SMRF/AWSM are setup to test with basins. Just trying to think of how the format fits with the other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this in here because I see this as the next improvement over how SMRF/AWSM does it and would also like to see this change propagate to there. If you look at the class, it basically describes the structure of the basin dir test data and is all you need in order to use the data in tests.
It also clearly separates test data from test logic, moving it in there.
Last argument I see is that the
test_dir
property was removed and this was never used anywhere else, showing that moving the class into the folder is the better place to keep it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does seem to be cleaner if we move that route. Then in SMRF, the RME/Lakes would be under their presepective directories.
The one major downside I see is discoverability for that class. You pretty much have to know that it's there, as in the SMRF case, it'll be buried a few directories down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see this downside addressed with documentation. Currently we have a need for that as a whole, on how they are set up, what parts tests what, or when it is appropriate to updated the gold files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes to documentation. But it's way easier to just code.