Conversation
| start_date = f"{year}-{month}-01" | ||
|
|
||
| # Drop last timestep (spin-up for next month) | ||
| ds = ds.isel(Times=slice(None, -1)) |
There was a problem hiding this comment.
Just a note, but the time coordinate in the COMPRESSED_RAIN ubc wrf files is just 'time', as opposed to the COMPRESSED_SUBSETTED and COMPRESSED_SNOW files where the time coordinate is 'Times'. Maybe it's possible to check the name of the time coordinate and adjust accordingly, so that it can process ubc wrf precip?
(Note that the precip and snow variables sometimes found in COMPRESSED_SUBSETTED are not necessarily correct and are to be ignored, as per chatting with Tim.)
There was a problem hiding this comment.
Just another quick note on the precip files should we choose to consider them--they have a different number of time steps per file than the SUBSETTED files.
For instance, COMPRESSED_RAIN_d03_metgrid_1999_09.nc has 720 timesteps, ranging from 1999-09-01_01:00:00 to 1999-10-01_00:00:00 (no Sept 00:00:00 time step!). As per Tim, this is because the precipitation values are valid for the preceding hour.
bobby-payne
left a comment
There was a problem hiding this comment.
Looks good! Added one minor comment about UBC-WRF's time coordinate (in its current state it won't be able to process the precipitation variables), but it may not be a big priority depending on our needs.
Add UBC WRF Data Loading Support
This PR adds support for loading UBC WRF metgrid output files, which require special handling due to their non-standard time coordinate structure.
Key Changes
New UBC WRF loader module (
ubc_wrf_io.py)YYYY/metgrid_YYYY_MM/*.nc)Core infrastructure updates
loaderparameter toClimateModelclass for data-source-specific loading strategiesload_grid()to dispatch to specialized loaders (e.g.,ubc_wrf) based on configurationXLAT,XLONG,Times)Configuration changes
loader: "ubc_wrf"and point to UBC WRF data directory structureland_mask,land_use, andsurface_roughnessfor downscaling applicationsPSFCvariable configuration for both HR and LR modelsuas,vas,tas, andpsby defaultBug fixes
is_west_negativeflag for temperature and wind variableslr_emulationmetadata pathsTechnical Details
UBC WRF file structure handled:
metgrid_YYYY_MM.ncTimecoordinate (all zeros) replaced with properpd.date_rangePerformance considerations:
Testing
✅ Tested with 2014-2017 subset of UBC WRF dataset (~1700 monthly files) on Venus
✅ Successful lazy loading and metadata computation
✅ Verified proper time coordinate generation and spin-up removal
Example Usage