[parallel-netcdf] #30: Action prohibited on NC_GLOBAL varid
Federico Carotenuto
carotenuto.federico at gmail.com
Fri May 26 09:34:51 CDT 2017
Dear Wei-keng,
Thanks to your suggestion I was able to work around the issue, just to be
faced with a different error about "Index exceeds dimension bound".
My code now looks like this:
ncstat = nfmpi_inq_varid(emisa_nc%id, 'Times', emisa_times_varid);
NCERR(__LINE__)
ncstat = nfmpi_inq_vardimid(emisa_nc%id,emisa_times_varid,dimidz);
NCERR(__LINE__)
write(*,*) "EMISA_TIMES HAS DIMID(1) = ",dimidz(1)
write(*,*) "EMISA TIMES HAS DIMID(2) = ",dimidz(2)
ncstat = nfmpi_inq_dim(emisa_nc%id,dimidz(1),dimchar1,lengttt1); NCERR(__LINE__)
ncstat = nfmpi_inq_dim(emisa_nc%id,dimidz(2),dimchar2,lengttt2); NCERR(__LINE__)
write(*,*) "DIMID(1) LENGTH = ",lengttt1
write(*,*) "DIMID(1) NAME = ",dimchar1
write(*,*) "DIMID(2) LENGTH = ",lengttt2
write(*,*) "DIMID(2) NAME = ",dimchar2
ncstat = nfmpi_get_vara_text_all(emisa_nc%id, emisa_times_varid, &
& (/i2offset(1), i2offset(ihourrun+1)/), (/i2offset(dlen),
i2offset(1)/), datebuf)
NCERR(__LINE__)
It appears that the correct varable id for "Times" was actually 4 from the
Fortran point of view. "Times" have two dimensions: 1 to store the time
itself in format "YYYY/MM/DD hh:mm:ss" (total length 19 characters), and 2
is the unlimited dimension time.
Now while dimension one with name "DateStrLen" has a correct length of 19,
the time dimension has apparently a length of 0, thus generating the
aforementioned error.
By checking on the file with other tools that dimension is unlimited but
should have length 3 in the file.
2017-05-26 14:14 GMT+02:00 Federico Carotenuto <
carotenuto.federico at gmail.com>:
> Dear Wei-keng,
>
> Thank you for your quick reply! Sorry if I'm replying via email but I
> can't find an option to reply to the ticket directly.
>
> I followed your suggestion and modified the source code in the following
> way, in order to echo the value of emisa_times_varid before NCERR
>
> write(*,*) "EMISA_TIMES_VARID =",emisa_times_varid
> ncstat = nfmpi_get_vara_text_all(emisa_nc%id, emisa_times_varid, &
> & (/i2offset(1), i2offset(ihourrun+1)/), (/i2offset(dlen), i2offset(1)/), datebuf)
> write(*,*) "EMISA_TIMES_VARID AFTER =",emisa_times_varid
> NCERR(__LINE__)
>
>
> In both cases, before and after the call to nfmpi, the value of
> emisa_times_varid is 0.
>
> As your links states that is effectively the NC_GLOBAL constant for
> Fortran.
>
>
>
>
> 2017-05-25 18:46 GMT+02:00 parallel-netcdf <parallel-netcdf at mcs.anl.gov>:
>
>> #30: Action prohibited on NC_GLOBAL varid
>> ------------------------------------------------------------
>> -----+----------
>> Reporter: Federico Carotenuto <carotenuto.federico@…> |
>> Owner: wkliao
>> Type: defect/bug |
>> Status: assigned
>> Priority: major |
>> Milestone:
>> Component: parallel-netcdf |
>> Version: 1.8.1
>> Keywords: |
>> ------------------------------------------------------------
>> -----+----------
>> Changes (by wkliao):
>>
>> * owner: robl => wkliao
>> * status: new => assigned
>>
>>
>> Comment:
>>
>> Hi,
>>
>> The Fortran constant NF_GLOBAL is defined in both NetCDF and PnetCDF as
>> value 0.
>> Its corresponding constant in C library NC_GLOBAL is defined as value -1.
>> The variable ID returned from the Fortran nfmpi_def_var API should have a
>> value larger than 0.
>> You might want to check the value of emisa_times_varid right after the
>> call to nfmpi_def_var.
>> Do let me know if you got 0 for emisa_times_varid.
>>
>> The MATLAB may return a value that is C based.
>>
>> See definition of nf_global in the NetCDF Fortran header file from this
>> URL[[br]]
>> https://github.com/Unidata/netcdf-
>> fortran/blob/master/fortran/netcdf3.inc#L96
>>
>> and PnetCDF Fortran header files from[[br]]
>> https://trac.mcs.anl.gov/projects/parallel-
>> netcdf/browser/trunk/src/libf/pnetcdf.inc.in#L161
>>
>> Wei-keng
>>
>> --
>> Ticket URL: <http://trac.mcs.anl.gov/projects/parallel-netcdf/ticket/30#
>> comment:1>
>> parallel-netcdf <https://trac.mcs.anl.gov/projects/parallel-netcdf>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/parallel-netcdf/attachments/20170526/01d7d25c/attachment-0001.html>
More information about the parallel-netcdf
mailing list