From a6606b52a6f0c47dd146927a0f7bafefd755129b Mon Sep 17 00:00:00 2001 From: Weiyuan Jiang Date: Wed, 11 Sep 2024 12:42:20 -0400 Subject: [PATCH] read explicit "string" attribute --- CHANGELOG.md | 1 + pfio/NetCDF4_FileFormatter.F90 | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f06b339e7036..efde291d1e9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Added ability to read the attribute with explicit type "string" of a netcdf variable. - Add ability to connect export of the MAPL hierachy to ExtData via CAP.rc file - Added new driver, CapDriver.x, to excerise the MAPL_Cap with the configuratable component also used by ExtDataDriver.x - Added Fortran interface to UDUNITS2 diff --git a/pfio/NetCDF4_FileFormatter.F90 b/pfio/NetCDF4_FileFormatter.F90 index 26b894e39b44..7ffc315bbbba 100644 --- a/pfio/NetCDF4_FileFormatter.F90 +++ b/pfio/NetCDF4_FileFormatter.F90 @@ -600,7 +600,6 @@ subroutine put_var_attributes(this, var, varid, unusable, rc) iter = attributes%begin() do while (iter /= attributes%end()) attr_name => iter%key() - p_attribute => iter%value() shp = p_attribute%get_shape() if (size(shp) == 0) then ! scalar @@ -1079,9 +1078,12 @@ subroutine inq_var_attributes(this, var, varid, unusable, rc) call var%add_attribute(trim(attr_name), str) deallocate(str) case (NF90_STRING) - !W.Y. Note: pfio does not support variable's string attribute - ! It only supports global 1-d string attribute - cycle + !$omp critical + status = pfio_get_att_string(this%ncid, varid, trim(attr_name), str) + !$omp end critical + _VERIFY(status) + call var%add_attribute(trim(attr_name), str) + deallocate(str) case default _RETURN(_FAILURE) end select