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.

[netcdfgroup] How to inquire if a NetCDF file is already open for reading or writing?

  • To: "netcdfgroup@xxxxxxxxxxxxxxxx" <netcdfgroup@xxxxxxxxxxxxxxxx>
  • Subject: [netcdfgroup] How to inquire if a NetCDF file is already open for reading or writing?
  • From: Hernan Arango <arango@xxxxxxxxxxxxxxxxxx>
  • Date: Fri, 22 Jan 2021 21:00:49 +0000
  • Authentication-results: unidata.ucar.edu; dkim=none (message not signed) header.d=none;unidata.ucar.edu; dmarc=none action=none header.from=marine.rutgers.edu;
Hello,

I am wondering if there is a function to determine if a NetCDF is already open 
for reading or writing based on the filename?   I am trying to avoid open too 
many files.   I know that there are ways in Unix to increase the number of open 
files, but that’s not what I am asking.   In parallel I/O running on lots of 
processes, there is a need to avoid opening too many files.   I am using both 
the standard NetCDF library and the PIO library that is the basis of the 
SCORPIO library (https://e3sm.org/scorpio-parallel-io-library).   Therefore, I 
have integer file ID (ncid) and file descriptors of TYPE (file_desc_t).

I am looking for something like:

     ncid=is_nc_open(‘my_file.nc’)
or
     fileDesc=is_pio_open(iosystem, my_paralle_file.nc’)

Thank you, H

----------------------------------------------------------------------
Hernan G. Arango           Department of Marine and Coastal Sciences
arango@xxxxxxxxxxxxxxxxxx<mailto:arango@xxxxxxxxxxxxxxxxxx>  Rutgers University
off: (848) 932-3368        71 Dudley Road
FAX: (732) 932-8578        New Brunswick, NJ 08901-8521, USA

http://www.researchgate.net/profile/Hernan_Arango
http://www.myroms.org
http://www.ocean-modeling.org