[Dart-dev] [7062] DART/trunk:

nancy at ucar.edu nancy at ucar.edu
Mon Jul 14 15:53:53 MDT 2014


Revision: 7062
Author:   thoar
Date:     2014-07-14 15:53:53 -0600 (Mon, 14 Jul 2014)
Log Message:
-----------

Added the NOWRITE option to the netcdf.open() to make it
behave more consistently for all versions of Matlab.

Turns out 'NC_NOWRITE' is/was version-specific.

Modified Paths:
--------------
    DART/trunk/diagnostics/matlab/plot_evolution.m
    DART/trunk/diagnostics/matlab/plot_rank_histogram.m
    DART/trunk/diagnostics/matlab/plot_rmse_xxx_evolution.m
    DART/trunk/diagnostics/matlab/two_experiments_evolution.m
    DART/trunk/matlab/CompareObsDiag.m
    DART/trunk/matlab/Compare_netCDF_files.m
    DART/trunk/matlab/nc_var_exists.m
    DART/trunk/models/POP/matlab/plot_evolution.m
    DART/trunk/models/POP/matlab/plot_rmse_xxx_evolution.m
    DART/trunk/models/POP/matlab/plot_spread_xxx_evolution.m
    DART/trunk/models/POP/matlab/two_experiments_evolution.m
    DART/trunk/models/gitm/matlab/plot_champ.m
    DART/trunk/models/gitm/matlab/plot_rmse_xxx_evolution.m

-------------- next part --------------
Modified: DART/trunk/diagnostics/matlab/plot_evolution.m
===================================================================
--- DART/trunk/diagnostics/matlab/plot_evolution.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/diagnostics/matlab/plot_evolution.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -523,7 +523,7 @@
 
 [variable_present, varid] = nc_var_exists(fname,varname);
 if (variable_present)
-   ncid  = netcdf.open(fname);
+   ncid  = netcdf.open(fname,'NOWRITE');
    value = netcdf.getVar(ncid, varid);
    netcdf.close(ncid)
 else

Modified: DART/trunk/diagnostics/matlab/plot_rank_histogram.m
===================================================================
--- DART/trunk/diagnostics/matlab/plot_rank_histogram.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/diagnostics/matlab/plot_rank_histogram.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -448,7 +448,7 @@
 
 [variable_present, varid] = nc_var_exists(fname,varname);
 if (variable_present)
-   ncid  = netcdf.open(fname);
+   ncid  = netcdf.open(fname,'NOWRITE');
    value = netcdf.getVar(ncid, varid);
    netcdf.close(ncid)
 else

Modified: DART/trunk/diagnostics/matlab/plot_rmse_xxx_evolution.m
===================================================================
--- DART/trunk/diagnostics/matlab/plot_rmse_xxx_evolution.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/diagnostics/matlab/plot_rmse_xxx_evolution.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -535,7 +535,7 @@
 
 [variable_present, varid] = nc_var_exists(fname,varname);
 if (variable_present)
-   ncid  = netcdf.open(fname);
+   ncid  = netcdf.open(fname,'NOWRITE');
    value = netcdf.getVar(ncid, varid);
    netcdf.close(ncid)
 else

Modified: DART/trunk/diagnostics/matlab/two_experiments_evolution.m
===================================================================
--- DART/trunk/diagnostics/matlab/two_experiments_evolution.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/diagnostics/matlab/two_experiments_evolution.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -599,7 +599,7 @@
 
 [variable_present, varid] = nc_var_exists(fname,varname);
 if (variable_present)
-   ncid  = netcdf.open(fname);
+   ncid  = netcdf.open(fname,'NOWRITE');
    value = netcdf.getVar(ncid, varid);
    netcdf.close(ncid)
 else

Modified: DART/trunk/matlab/CompareObsDiag.m
===================================================================
--- DART/trunk/matlab/CompareObsDiag.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/matlab/CompareObsDiag.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -44,8 +44,8 @@
 
 f1info     = ncinfo(file1);
 nvariables = length(f1info.Variables);
-ncid1      = netcdf.open(file1,'NC_NOWRITE');
-ncid2      = netcdf.open(file2,'NC_NOWRITE');
+ncid1      = netcdf.open(file1,'NOWRITE');
+ncid2      = netcdf.open(file2,'NOWRITE');
 
 % Loop over all the variables in the first file ... the variables
 % can be in any order in either file. I do not check to see if

Modified: DART/trunk/matlab/Compare_netCDF_files.m
===================================================================
--- DART/trunk/matlab/Compare_netCDF_files.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/matlab/Compare_netCDF_files.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -52,7 +52,7 @@
 
 f1info     = ncinfo(file1);
 nvariables = length(f1info.Variables);
-ncid1      = netcdf.open(file1,'NC_NOWRITE');
+ncid1      = netcdf.open(file1,'NOWRITE');
 
 for ivar = 1:nvariables
 
@@ -99,8 +99,8 @@
 end
 
 nvariables = length(f1info.Variables);
-ncid1      = netcdf.open(file1,'NC_NOWRITE');
-ncid2      = netcdf.open(file2,'NC_NOWRITE');
+ncid1      = netcdf.open(file1,'NOWRITE');
+ncid2      = netcdf.open(file2,'NOWRITE');
 
 % grab the variable name from one file and 
 % search the second file for matching variable.

Modified: DART/trunk/matlab/nc_var_exists.m
===================================================================
--- DART/trunk/matlab/nc_var_exists.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/matlab/nc_var_exists.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -17,7 +17,7 @@
 %
 % EXAMPLE 3 (also a success):
 % fname = 'obs_diag_output.nc';
-% ncid  = netcdf.open(fname,'NC_NOWRITE');
+% ncid  = netcdf.open(fname,'NOWRITE');
 % varname = 'time';
 % [variable_present, varid] = nc_var_exists(fname,varname);
 % if (variable_present), mytime = netcdf.getVar(ncid,varid); end
@@ -38,7 +38,7 @@
    if (strcmp(finfo.Variables(ivar).Name, deblank(varname)))
       % TJH DEBUG  fprintf('Matched Variable "%s" \n', vinfo.Variables(ivar).Name )
       variable_present = 1;
-      ncid  = netcdf.open(fname,'NC_NOWRITE');
+      ncid  = netcdf.open(fname,'NOWRITE');
       varid = netcdf.inqVarID(ncid,varname);
       netcdf.close(ncid);
       return

Modified: DART/trunk/models/POP/matlab/plot_evolution.m
===================================================================
--- DART/trunk/models/POP/matlab/plot_evolution.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/models/POP/matlab/plot_evolution.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -529,7 +529,7 @@
 
 [variable_present, varid] = nc_var_exists(fname,varname);
 if (variable_present)
-   ncid  = netcdf.open(fname);
+   ncid  = netcdf.open(fname,'NOWRITE');
    value = netcdf.getVar(ncid, varid);
    netcdf.close(ncid)
 else

Modified: DART/trunk/models/POP/matlab/plot_rmse_xxx_evolution.m
===================================================================
--- DART/trunk/models/POP/matlab/plot_rmse_xxx_evolution.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/models/POP/matlab/plot_rmse_xxx_evolution.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -541,7 +541,7 @@
 
 [variable_present, varid] = nc_var_exists(fname,varname);
 if (variable_present)
-   ncid  = netcdf.open(fname);
+   ncid  = netcdf.open(fname,'NOWRITE');
    value = netcdf.getVar(ncid, varid);
    netcdf.close(ncid)
 else

Modified: DART/trunk/models/POP/matlab/plot_spread_xxx_evolution.m
===================================================================
--- DART/trunk/models/POP/matlab/plot_spread_xxx_evolution.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/models/POP/matlab/plot_spread_xxx_evolution.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -541,7 +541,7 @@
 
 [variable_present, varid] = nc_var_exists(fname,varname);
 if (variable_present)
-   ncid  = netcdf.open(fname);
+   ncid  = netcdf.open(fname,'NOWRITE');
    value = netcdf.getVar(ncid, varid);
    netcdf.close(ncid)
 else

Modified: DART/trunk/models/POP/matlab/two_experiments_evolution.m
===================================================================
--- DART/trunk/models/POP/matlab/two_experiments_evolution.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/models/POP/matlab/two_experiments_evolution.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -632,7 +632,7 @@
 
 [variable_present, varid] = nc_var_exists(fname,varname);
 if (variable_present)
-   ncid  = netcdf.open(fname);
+   ncid  = netcdf.open(fname,'NOWRITE');
    value = netcdf.getVar(ncid, varid);
    netcdf.close(ncid)
 else

Modified: DART/trunk/models/gitm/matlab/plot_champ.m
===================================================================
--- DART/trunk/models/gitm/matlab/plot_champ.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/models/gitm/matlab/plot_champ.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -285,7 +285,7 @@
 
 
 %load PRIOR
-ncid  = netcdf.open('Prior_Diag.nc','NC_NOWRITE');
+ncid  = netcdf.open('Prior_Diag.nc','NOWRITE');
 LonD   = double(netcdf.getVar(ncid, netcdf.inqVarID(ncid, 'LON') ) );
 LatD   = double(netcdf.getVar(ncid, netcdf.inqVarID(ncid, 'LAT') ) );
 AltD   = double(netcdf.getVar(ncid, netcdf.inqVarID(ncid, 'ALT') ) );
@@ -297,7 +297,7 @@
 netcdf.close(ncid)
 
 %load POSTERIOR
-ncid  = netcdf.open('Posterior_Diag.nc','NC_NOWRITE');
+ncid  = netcdf.open('Posterior_Diag.nc','NOWRITE');
 td =  netcdf.getVar(ncid, netcdf.inqVarID(ncid,'time'))... %td=Time DART (number of minutes since beginning of 12/01/2002)
     + datenum([1601 01 01 00 00 00]) ... %DART starts its timekeeping from 01/01/1601
     - datenum([2002 12 01 00 00 00]);    %This file counts time       from 12/01/2002

Modified: DART/trunk/models/gitm/matlab/plot_rmse_xxx_evolution.m
===================================================================
--- DART/trunk/models/gitm/matlab/plot_rmse_xxx_evolution.m	2014-07-14 21:22:19 UTC (rev 7061)
+++ DART/trunk/models/gitm/matlab/plot_rmse_xxx_evolution.m	2014-07-14 21:53:53 UTC (rev 7062)
@@ -546,7 +546,7 @@
 
 [variable_present, varid] = nc_var_exists(fname,varname);
 if (variable_present)
-   ncid  = netcdf.open(fname);
+   ncid  = netcdf.open(fname,'NOWRITE');
    value = netcdf.getVar(ncid, varid);
    netcdf.close(ncid)
 else


More information about the Dart-dev mailing list