[netcdfgroup] read array of strings with f90

  • To: netcdfgroup@xxxxxxxxxxxxxxxx
  • Subject: [netcdfgroup] read array of strings with f90
  • From: M P <mzp3769@xxxxxxxxx>
  • Date: Mon, 10 Oct 2022 19:52:30 -0600
  • Arc-authentication-results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=csDyuqvf; spf=pass (google.com: domain of mzp3769@xxxxxxxxx designates 209.85.220.41 as permitted sender) smtp.mailfrom=mzp3769@xxxxxxxxx; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=Br8y5RVvZjsMISxg70lRqI9IAzAOOpgmn49m5uXBdoc=; b=ascpsVr4UFprkPYc5CjlRyqHfholDFP1xv+MY+t0YNOW5c0muj7NcRg55D78BTV+7r jzULrr+jdep/Uz9CtGvIV/a2G9GkdseYQdsI6oo8BfI12HhbrO3CguzrVaHaKmbEJP0b atGaHuKUbIlQm92LeLcuQ9k89JEj/jQX8ApVm8R9B7aYvVNBNaAAC635azOOsWGF56PK aZtUajR9vzd2Z84bAloo178PBMxNEwuJ1W/Gi1hVACBxfrs7D/uH7u5lUbbu8AYfNkOo TJikimAx6KOovTrEif1fK6BhY3HIGEDkYAzmSwg+ie5YlU4HIYpbSU+6hgEsl5k21lkZ /Fbw==
  • Arc-seal: i=1; a=rsa-sha256; t=1665453167; cv=none; d=google.com; s=arc-20160816; b=vApwBXcLW8ARL7Cs2RwIvzd9luTLEdG9vPbn4nmr2EH542skLiFWKDwfvAdwpk8MwA vh/LNCmguJWF4lbw4oaIuGeBmB4CX+WS1SiZhfiFa0pMCllriPq79P+j8VTs33B1Y9Do beApVvKuI2eE4nF6w+vbZoHnvRErVV5AxCFQKLHgLgigPbKkfqaUIOGDdKebjfY80CSY okTIEhLCvCiTe/yJYTHOaBfnTfGWQxfih5i5OzmFG2DxYNXcbyx773K0a5Bw3tsHOEKE tLiksfUU0lYpnn33RzTfwfeZoMYDvZrea90WBUtwJPYRPznyrwwyHwOY82hk94BCJGLK hZww==
  • Authentication-results: vscanx3.ucar.edu; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=csDyuqvf
  • Authentication-results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=csDyuqvf; spf=pass (google.com: domain of mzp3769@xxxxxxxxx designates 209.85.220.41 as permitted sender) smtp.mailfrom=mzp3769@xxxxxxxxx; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Hello,
Is it possible to read an array of strings (constant length) in fortran?
Below are specifics. Comments/help much appreciated - thanks.
Mark

netcdf file:
....

        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",
.......

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
  • 2022 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: