CWorthy-ocean / roms-tools

Tools for creating input files for UCLA-ROMS simulations
https://roms-tools.readthedocs.io
Apache License 2.0
11 stars 5 forks source link

more than one entry needed for surface forcing #89

Closed dafyddstephenson closed 2 months ago

dafyddstephenson commented 3 months ago
roms_frc_bgc= rt.SurfaceForcing(
    grid=roms_grd,
    start_time=dt.datetime(2012, 1, 1, 0, 0, 0),
    end_time=dt.datetime(2012, 2, 1, 0, 0, 0),
    physics_source={"name": "ERA5", "path": datadir+'ERA5*.nc'},
    bgc_source={"name": "CESM_REGRIDDED", "path": datadir+"CESM-surface_lowres_regridded.nc"},
    correct_radiation=True,
    use_coarse_grid=True,
)
roms_frc.save(filepath='roms_frc')

This generates two forcing files, as expected. The issue I experience is that the physics file has 744 entries under time, while the BGC file has just 1. While this is consistent with the data that went in to generating the forcing, I believe ROMS needs at least two entries to interpolate between, and so aborts on initialisation: ERROR: find_new_record: Ran out of time records for dust

Summary: Forcing objects should always have at least two time entries.

dafyddstephenson commented 3 months ago

Related: #82

NoraLoose commented 3 months ago

Thanks for raising this @dafyddstephenson! Do the two time entries have to fully enclose the ROMS simulation? Or will ROMS extrapolate?

dafyddstephenson commented 3 months ago

I'm quite certain ROMS will interpolate between two values 1000+ years apart but will not extrapolate...

NoraLoose commented 3 months ago

So if you want to run your simulation from January 1 to February 1, we can't just give it two values on January 15 and February 15. Instead we need three values: on December 15, January 15, February 15?

dafyddstephenson commented 3 months ago

I think we can give it Jan 1st and Feb 1st. If we only have 15ths available then yes it would be Dec 15th of the previous year to Feb 15th of the current year.

However the one value I am currently getting in my forcing file corresponds to January 1st 2012, not January 15th

NoraLoose commented 3 months ago

Solved via #100