ESCOMP / CDEPS

Community Data Models for Earth Prediction Systems
https://escomp.github.io/CDEPS/versions/master/html/index.html
20 stars 45 forks source link

Allow streams files without a time axis #284

Open samsrabin opened 4 months ago

samsrabin commented 4 months ago

Some streams files are intended to be static, but that's seemingly not allowed. Instead, every streams file (and, presumably, every variable being read from streams files) must have a time axis. This requires the addition of a "dummy" time axis on files that don't need it.

I think it would be better if a time axis were optional. This would make the code cleaner (avoiding time-related stuff that's not needed), avoid headaches (making an input file but forgetting to add the dummy time axis), and improve strictness (throw an error if a user supplies a streams file with a time axis for an input that's supposed to be static).

As far as what this would look like, I'd think the following arguments to shr_strdata_init_from_inline() would be made optional:

If any of these were provided, then the streams file would require a time axis, and all those arguments would need to be provided.

If those arguments weren't provided but the user-supplied streams file does have a time axis, CDEPS would throw an error.

uturuncoglu commented 4 months ago

@samsrabin I think this is possible with exiting implementation. See following entry,

taxmode02:               cycle
mapalgo02:               consd
tInterpAlgo02:           lower
readMode02:              single
dtlimit02:               1.5
stream_offset02:         0
yearFirst02:             2022
yearLast02:              2022
yearAlign02:             2022
stream_vectors02:        null
stream_mesh_file02:      INPUT_DATA/ESMFmesh.nc
stream_lev_dimname02:    null
stream_data_files02:     INPUT_DATA/mask.nc
stream_data_variables02: "glmask So_omask"
stream_dst_mask02:       1

In this case, file has time axis but its length is just 1 and CDEPS is cycling it. I am using it for fixed fields like mask, topography etc.

uturuncoglu commented 4 months ago

Of course, the data file still need to have time axis to support this. CDEPS always requires it to read data. I am not sure if we could make those variables optional in the namelist file. BTW, this is ESMF config format which is not used by the CESM as I know. CESM used XML instead.

samsrabin commented 4 months ago

Yes, it's possible to handle static streams files by just supplying a file with one timestep. We do it in at least three places in CTSM, plus one more that I'm working on now. My point is that it's annoying to have to do, for the reasons I outlined up above.