This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hello, My apologies for the delayed response. I will try to discover the answer for you, but unfortunately Unidata does not currently have any Fortran expertise in-house. As a result, Fortran questions take an extended amount of time to resolve. Are you able to provide the netCDF file you are working with? The first step will be to see what happens using the C library interface. Since the Fortran interface is essentially a hook into the C library, we can begin there and work backwards. Thank you, -Ward > Support, > > I have a NetCDF with 1 to N global attributes (NF90_GLOBAL). I have > successfully pulled all attribution from a variable and replicated that > attribution from source to target. > > When I attempt to obtain the number of global attributes via: > > status = nf90_inquire(inc_ncid, nDims, nVars, nGlobalAtts, unlimitedID) > > my nGlobalAtts returns with a number three (3). There are far more > global variables in the subject file than three (3). The value returned > are: source, title, version. > > Researching the issue I found reference to NF90_INQ_[ATTNAME, ATTRIBUTE] > in section 7.3 there is reference to a NF90_INQ_VARNATTS. The subject > variable number of attributes doesn't appear to exist sans the > documentation in this section. > > |attnum| > For NF90_INQ_ATTNAME, the input attribute number; for > NF90_INQ_ATTID, the returned attribute number. The attributes for > each variable are numbered from 1 (the first attribute) to NATTS, > where NATTS is the number of attributes for the variable, as > returned from a call to NF90_INQ_VARNATTS. > > > Reference: > https://www.unidata.ucar.edu/software/netcdf/docs-fortran/f90-attributes.html > > There doesn't appear to be a NF90_INQ_VARNATTS in the inventory of the > API verified by source code and documentation searches (I recognize I > could have easily missed something). > > How does one find the number of global attributes so they can be copied > from source to target? > > Please advise if the question is malformed, inappropriate or requires > additional commentary. > > I truly appreciate any review of this request. > > -- > Christopher Wood, PMP, CSM, EACOE, SOACP Computer Scientist > > Bio-Optical/Physical Processes and Remote Sensing Section Code 7331 Naval > Research Laboratory > 1009 Balch Blvd., Stennis Space Center, MS 39529-5004 > > Cell (228) 216-5933 > https://www7330.nrlssc.navy.mil/ > > Ticket Details =================== Ticket ID: EOB-623455 Department: Support netCDF Priority: Critical Status: Closed =================== NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.