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

HRRR module #27

Merged
merged 27 commits into from
Dec 29, 2020
Merged

HRRR module #27

merged 27 commits into from
Dec 29, 2020

Conversation

jomey
Copy link
Collaborator

@jomey jomey commented Dec 28, 2020

When going through the code of loading HRRR files, I found myself a bit lost. The current hrrr.py has all the logic around loading of files on disk as well as fetching from remote sources.

This PR breaks the HRRR tome (as I called it) apart into separate pieces and establishes a structure that allows for different weather sources. (Thinking of GOES here).

Centralized a few pieces as for instances fetching a name for a HRRR file. Also established a testing infrastructure similar to SMRF, where there is a basic class that uses RME data.

Looks like a lot of new code, but essentially moves pieces around.

The slight change I introduced is around the logic for getting data from files on disk. There, the call to combine by coordinates is now outside the loading data from disk.

jomey added 25 commits December 24, 2020 12:52
Start a new HRRR Data handling class and initialize with moving the
filename finder method from utils. More functionality to be moved there
soon.
Create a base class for all unit tests that use data of RME. Contains
all required directories and some other basic basin info as attributes.
Also takes care of creating and cleaning up of outputs created in each
test case.
Add a helper method to be able to skip tests that require an external
HTTP request via environment variable. This speeds up running the whole
suite against only local data.
Change the VARIABLE of the HRRRPreprocessor to be an immutable tuple.
This changes the instance to use a copy of that constant and enables
changing of an individual instance without affecting the set on the
class.
Add a central method to the utils that sets up the logging either to a
given config or a default instance.
Also slightly change the message formatting and add a space before the
message.
Move the logic that retrieves data via FTP to a dedicated class. Start
on breaking up the HRRR class tome.
Move the logic that retrieves data via HTTP to a dedicated class.
Chipping away on the HRRR class tome.
Looks a lot like the get_data method and was commented out to begin with
Move HTTP request specific attributes to the dedicated class.
Create basic class that knows how to parse a config file and sets up
a logger. See doc for more details.
Add a base class to serve as super class for local HRRR files to be
read.
Use ConfigFile as super class for HTTPRetrieval. Also add HTTP specific
configuration options to be read from a configuration file and have them
accessible as properties.
Last change is to use the FileHandler for date formatting of HRRR files.
Add the start and end date as a class constant so they are readily
accessible in tests.
Extract logic from the HRRR tome to the hrrr data module. This separates
the logic to load data on disk independent of the data format to one
class, while separate classes contain the logic for each format. Added
some basic specs around the loader logic
All logic from the HRRR tome was moved to the data module. Keeping the
HRRR class around for backwards compatibility. To be retired.
@jomey jomey marked this pull request as ready for review December 28, 2020 16:03
@jomey jomey requested a review from scotthavens December 28, 2020 16:03
tests/data/hrrr/test_file_loader.py Show resolved Hide resolved
tests/data/hrrr/test_file_loader.py Show resolved Hide resolved
tests/test_hrrr_preprocessor.py Show resolved Hide resolved
weather_forecast_retrieval/data/hrrr/file_loader.py Outdated Show resolved Hide resolved
@scotthavens
Copy link
Contributor

Nice work on this Joe! Was the skiing that bad?

Opened #28 to remove the FTP and OpenDAP so I'm not super concerned about those tests.

How does this play with SMRF? Would be interested to hear if the SMRF tests pass using this branch .

@jomey
Copy link
Collaborator Author

jomey commented Dec 28, 2020

Nice work on this Joe! Was the skiing that bad?

Opened #28 to remove the FTP and OpenDAP so I'm not super concerned about those tests.

How does this play with SMRF? Would be interested to hear if the SMRF tests pass using this branch .

Yeah, our storms keep under-producing and the coverage isn't consistent yet. Many sharks still sticking out.

SMRF was my mini integration suite. I have WFR installed in pip editable mode. Then every time I changed things in WRF I also run the HRRR test (test_hrrr) within SMRF. That one passes. Any other you can think of?

Also adds a test for this parameter option.
The logic never raised an error once all six forecast hours were not
successfully loaded.
@jomey jomey merged commit 2e2d27c into main Dec 29, 2020
@jomey jomey deleted the file_loading branch December 29, 2020 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants