Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
Hello, >From this group's archive and searches I figured that reading those with f90 is probably not possible. I wrote a simple code in C but that also is not successful. Can you help with solving this problem? Thanks, Mark netcdf file (datetime elements always 20 chars) .... int nlocs(nlocs) ; nlocs:suggested_chunk_dim = 429LL ; .... group: MetaData { variables: string datetime(nlocs) ; string datetime:_FillValue = "" ; string datetime:units = "" ; ncdump -v datetime file.nc ....... datetime = "2021-09-30T23:02:25Z", "2021-09-30T23:07:25Z", "2021-09-30T23:09:23Z", "2021-09-30T23:17:25Z", "2021-09-30T23:19:22Z", ....... C code: (nlocs, length=20 are set to correct values) ... int status; .. size_t start[] = {0,0}; size_t count[] = {nlocs,length+1}; char datetime[nlocs][length+1]; char *datetime_p[nlocs]; ... for (i = 0; i < nlocs; i++) datetime_p[i] = datetime[i]; ... if ((status = nc_get_vara_string(grpid, varid, start, count, datetime_p))) ERR(status); /* Error: NetCDF: Start+count exceeds dimension bound */ if ((status = nc_get_vara(grpid, varid, start, count, datetime_p))) ERR(status); /* Error: NetCDF: Start+count exceeds dimension bound* / if ((status = nc_get_var(grpid, varid, datetime_p))) ERR(status); /* values in array are garbage */ if ((status = nc_get_var(grpid, varid, &datetime[0][0]))) ERR(status); /* values in array are garbage */ ........ f90 code: ....... INTEGER, PARAMETER :: date_string_length=20 CHARACTER(len=date_string_length), ALLOCATABLE :: aertimestr(:) ....... CALL check_nc(nf90_inq_grp_ncid(ncid,"MetaData",grpid)) CALL check_nc(nf90_inq_varid(grpid,"datetime",varid)) CALL check_nc(nf90_get_var(grpid,varid,aertimestr)) ....... Error: NetCDF: Attempt to convert between text & numbers
netcdfgroup
archives: