Skip to content

Streamline input data loading and interpolation code#38

Merged
jomey merged 12 commits into
mainfrom
input_load
Oct 31, 2025
Merged

Streamline input data loading and interpolation code#38
jomey merged 12 commits into
mainfrom
input_load

Conversation

@jomey

@jomey jomey commented Oct 30, 2025

Copy link
Copy Markdown
Member

Couple of changes to this PR:

  • Only load metadata once per initialized day for HRRR
  • Retrieve the loaded data straight from the relevant class instead of copying to the proxy class
  • Load all data and metadata for any other input source (CSV, NetCDF)
  • Use KDTree to calculate n-closest distances for each grid cell
  • Only filter to stations if they are configured in the relevant section in the .ini file
  • Renamed all interpolation classes to descriptive names

Note regards the change to use KDTree - I have been running that successfully for multiple water years and domains at the CBRFC.

jomey and others added 11 commits October 22, 2025 20:53
Suggest by CoPilot to speed up this calculation.
Replace the `apply` call with a function and reduce number of df
transformations.
Also introduces class constants to easier identify which algorithm was
requested.
This renames classes, variables, and method args to conform with Python
naming conventions.
The `variables` and `data_variables` were unused when determining if wind data needs to be
loaded or not based on the config values.
Reduce the complexity of accessioning the loaded data from the loading class that was
previously copied to the proxy class to determine the data type and have the model
framework logic directly access the loader class.
Expand the base class for all loaded gridded data to hold attributes for metadata and
data.
Split out the call to load metadata versus variable data for HRRR. Now HRRR metadata gets
only loaded once per class initialization and the variable data per time step. Stations
are now only filtered when there are any set with the config corresponding section. This
should be a small performance boost by reducing data load that is not needed/used.
Ran into this while running the "baseline" iSnobal. Not particularly related to this branch but will hopefully be merged soon.
@jomey
jomey requested a review from a team October 30, 2025 17:18
Comment thread smrf/data/input_data.py

@arobledano arobledano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, big effort here. Nice job!!

@jomey
jomey merged commit 77563f0 into main Oct 31, 2025
1 check passed
@jomey
jomey deleted the input_load branch October 31, 2025 14:26
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