NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
> These latter two functions accept NF90_GLOBAL as “varid” but an error is > thrown when this is used for varid in nf90_inquire_variable(). This may be a bug. The netCDF Fortran 90 document did not say using NF90_GLOBAL in the varid argument is illegal. As nf90_inquire_variable() calls nc_inq_var() internally, the netCDF-C 4.3.3.1 document for nc_inq_var() also did not say using NC_GLOBAL is illegal. Although nf90_inquire() can get you the desired result as pointed out by Nick Papior, but you may still want to report this possible bug to the Unidata netCDF Support <support-netcdf@xxxxxxxxxxxxxxxx> Wei-keng On Jul 14, 2015, at 11:13 AM, <Jim.Enright@xxxxxxxxxxxxxx> <Jim.Enright@xxxxxxxxxxxxxx> wrote: > Hi, > > I’m wondering if it is possible to use the nf90_inquire_variable() function > to find information about global attributes in a similar way to > nf90_inquire_attribute()? > For example, should it be possible to set varid to be NF90_GLOBAL to find the > number of global attributes? i.e.: > call check(nf90_inquire_variable(ncid, NF90_GLOBAL, nAtts = numAttr)) > > The reason for this query is because we have a code block (snippet shown > below) which prints some header information by looping over an array of > variables. > It first calls nf90_inquire_variable to get the number of attributes and then > uses this to get more details about the attributes by calling > nf90_inq_attname() and nf90_inquire_attribute(). > These latter two functions accept NF90_GLOBAL as “varid” but an error is > thrown when this is used for varid in nf90_inquire_variable(). > Is this the expected behaviour of nf90_inquire_variable? If so, can you > recommend the best alternative way to get the number of global attributes – > nf90_inquire() perhaps? > > do idxVar = varBegin, numVars > > varName = varInfoArray%varInfoArr(idxVar)%varName > > if( varName .eq. 'UNDEFINED' ) then > varid = nf90_global > else > varid = varInfoArray%varInfoArr(idxVar)%varId > end if > > call check( nf90_inquire_variable( ncid, varid, nAtts = numAttr ) > … > … > do idxAttr = 1, numAttr > > ! Get the names & details of the attributes > call check( nf90_inq_attname( ncid, varid, idxAttr, attrName )) > > call check( nf90_inquire_attribute( ncid, varid, attrName, netCDFType, > numAttrValues )) > end do > … > end do > > Best regards, > Jim > ______________________________________________________________________ > > Fujitsu Laboratories of Europe Limited > Hayes Park Central, Hayes End Road, Hayes, Middlesex, UB4 8FE > Registered No. 4153469 > > This e-mail and any attachments are for the sole use of addressee(s) and > may contain information which is privileged and confidential. Unauthorised > use or copying for disclosure is strictly prohibited. The fact that this > e-mail has been scanned by Trendmicro Interscan does not guarantee that > it has not been intercepted or amended nor that it is virus-free. > > _______________________________________________ > netcdfgroup mailing list > netcdfgroup@xxxxxxxxxxxxxxxx > For list information or to unsubscribe, > visit:http://www.unidata.ucar.edu/mailing_lists/
netcdfgroup
archives: