Unidata / netcdf-fortran

Official GitHub repository for netCDF-Fortran libraries, which depend on the netCDF C library. Install the netCDF C library first.
Other
244 stars 98 forks source link

Support for single string attributes in read #453

Open graziano-giuliani opened 1 month ago

graziano-giuliani commented 1 month ago

Partial modification to allow netCDF Fortran library able to read single string attributes from a netCDF4 CF-1.9 compliant using string type for attributes. It overloads the nf90_get_att_text function returning a single string attribute (note the nlen == 1 in the patch) as if it is a character attributes. What is not implemented are multidimensional strings, and the capability to write string attributes, because of the lack of string type in Fortran standard. This patch would allow reading netCDF files like the one created from the Copernicus cds-beta site for ECMWF ERA5 model. See reference to this in issue #181 "string attributes are not supported yet?"

CLAassistant commented 1 month ago

CLA assistant check
All committers have signed the CLA.

WardF commented 1 month ago

Thank you!

edwardhartnett commented 1 month ago

Can you add a test or two as well?

WardF commented 2 weeks ago

@graziano-giuliani Is there any chance you could help us by adding a test for this as well?