[ncl-talk] suggestion for addfile(s) status flags

Cathy Smith (NOAA Affiliate) cathy.smith at noaa.gov
Mon Jun 8 14:31:36 MDT 2015


NCL staff
I've run into an issue a bunch of times where I was running code that 
creates a new netCDF file. If I'm debugging or if I have updated data 
which goes into the file, when I open a file with status value "c", the 
code fails as the file already exists. If the file doesn't exist yet, 
then I can't use "w" as a new file needs to be created. I can write 
something where I test for the file and if it exists, I can decide to 
delete the old copy first or write to the old file but it seems kludgy. 
I can of course delete the old file first when using "c" before running 
the code but sometimes I forget and sometimes someone else runs the code 
and gets a permission error which they don't understand.

I was wondering if it would be useful to have 2 new status flags to 
addfile(s). Maybe "cd" and "cw". The first would check for the file 
first and delete it if it already existed and then open the new file. 
The second would open the file with a "w" if it already existed. These 
would act more like C or Fortran flags. If a user was worried about 
accidentily deleting or writing to old files, they could still use "c".

It's just a suggestion and there could be issues I am not considering, 
of course.

Cathy

-- 
----------------------------------------------
NOAA/ESRL PSD and CU CIRES
303-497-6263
http://www.esrl.noaa.gov/psd/people/cathy.smith/

Emails about data/webpages may get quicker responses from emailing
esrl.psd.data at noaa.gov



More information about the ncl-talk mailing list