Open theurich opened 1 year ago
A few more pieces of information:
ESMFproto_FieldBundleWrite()
, and not for files written directly via NetCDF calls (https://github.com/ufs-community/ufs-weather-model/issues/1621#issuecomment-1452189598). This does make sense because ESMFproto_FieldBundleWrite()
does go through the ESMF_FieldBundleWrite()
method, which now strictly preserves the typekind of attributes.ESMFproto_FieldBundleWrite()
routine, which is located in the FV3 write component, with a direct call into the official ESMF_FieldBundleWrite()
method, now that the latter is multi-tile enabled, as of ESMF 8.4.0.
This is a request to look through the existing ESMF_Attribute, and/or ESMF_Info unit testing to make sure we successfully test that the typekind of meta data is kept in tact from when it is set to where it is retrieved. If testing is incomplete, it needs to be extended.
This request is triggered by issue https://github.com/ufs-community/ufs-weather-model/issues/1621, specifically comment https://github.com/ufs-community/ufs-weather-model/issues/1621#issuecomment-1450631888 that seems to indicate that in the latest version of ESMF (v8.4.1b07, but likely also on develop) integer attributes set on a FieldBundle show up as strings in the NetCDF file:
The comparison here between the two outputs is v8.4.1b07 vs v8.3.0b09. A relevant ESMF commit between those two versions is likely https://github.com/esmf-org/esmf/commit/6906b7b22641cfd46c42c1388f30f31feaf45280. But there may be others.
There is a lot going on from where the Attributes are being set in the FV3 write component (https://github.com/NOAA-EMC/fv3atm/blob/develop/io/FV3GFS_io.F90#L3467) to where they are written to NetCDF in side the ESMF code (https://github.com/esmf-org/esmf/blob/c55cd8ec6b3e9392352dad59cd63ffc8268d024b/src/Infrastructure/IO/src/ESMCI_PIO_Handler.C#L1423). It involves the deprecated ESMF_Attribute layer, but that is still used here for the I/O Attributes, it involves the ESMF_Info implementation of the meta data handling, and then finally the I/O layer to write the attributes to NetCDF. Review and extension of testing on all those levels might be needed.