ai2cm / fv3net

explore the FV3 data for parameterization
MIT License
16 stars 3 forks source link

Standardize array inputs to always have a z dimension, even if it is size 1 #2273

Closed AnnaKwa closed 1 year ago

AnnaKwa commented 1 year ago

Various places in the reservoir code assume the last dim of input arrays is the feature dimension, which is not the case when the input is a 2D field. The training code calls the assure_same_dims function which adds a z dim of size 1 if other 3D fields are present, but this doesn't handle the edge case where only 2D inputs are present (this would probably be the format of data for SST models). At inference, the adapter assumes the last dim of each variable is the feature dim. For both of these cases we should add some code early on in the array creation to reshape to add a feature dim of size 1 for 2D fields.