Index: /trunk/tools/nc_var.py
===================================================================
--- /trunk/tools/nc_var.py	(revision 1374)
+++ /trunk/tools/nc_var.py	(revision 1375)
@@ -34,4 +34,8 @@
 ## e.g. # nc_var.py -o compute_opersvarsfiles -S 'lon|lon|-1;lat|lat|-1;time_counter|time_counter|-1@forwrdderiv,1,1,2|/ccc/store/cont003/gen7593/fitaborl/etudes/DynamicoESM/aquaplanet/AR40/19800101000000-19810101000000/histday.nc|t2m' -v 'tasderiv,x-derivative|of|air|temperature,K
 ## e.g. # nc_var.py -o getvars_tofile -S soils_param_Zobler_textXIOS.nc -f soils_param_colorXIOS.nc -v 'soiltext,soiltexttypes'
+## e.g. # nc_var.py -o addVar -S 'lon,lat|mask@mask@1|f' -f new_ORCHIDEE_13PFTmap_2010_cmpi6_LUH2v2h.nc -v mask
+## e.g. # nc_var.py -o setvar_nc -S 'new_ORCHIDEE_13PFTmap_2010_cmpi6_LUH2v2h.nc,maxvegetfrac,veget;0' -f new_ORCHIDEE_13PFTmap_2010_cmpi6_LUH2v2h.nc -v mask
+## e.g. $ nc_var.py -o VarVal_FillValue -S '0.,eq,std' -f new_lai2D.nc -v LAI
+## e.g. # nc_var.py -o rm_FillValue -f new_ORCHIDEE_13PFTmap_2010_cmpi6_LUH2v2h.nc -S 0 -v mask
 
 from optparse import OptionParser
@@ -44,4 +48,5 @@
 import generic_tools as gen
 
+# addVar: Operation to add a new variable in a file using exisintg dimensions
 # addvals: Function to add values to a given variable at a given dimension
 # CDO_toCF: Function to pass a CDO output file to CF-conventions
@@ -104,4 +109,5 @@
 #   giving Header, Middle, Tail for the name files
 # reproject: Function to reproject values to another one
+# rm_FillValue: Operation to remove the _FillValue from a variable inside a netCDF file
 # Partialmap_Entiremap: Function to transform from a partial global map (e.g.: only land points) to an entire one 
 #   Coincidence of points is done throughout a first guess from fractions of the total domain of search
@@ -117,5 +123,6 @@
 # sellonlatlevbox: Function to select a lotlan box and a given level from a data-set
 # selvar: Function to select a series of variables from a netcdf file. Variables with 
-# setvar_asciivalues: Function to set de values of a variable with an ASCII file (common 
+# setvar_asciivalues: Function to set de values of a variable with an ASCII file (common Fortran-like format)
+# setvar_nc: Operation to set values of a variable from values of an other one
 # sorttimesmat: Function to sort the time values of a given file
 # spacemean: Function to retrieve a space mean series from a multidimensional variable of a file
@@ -146,6 +153,6 @@
 # WRF_toCF: Function to pass a WRF original file to CF-conventions
 
-operations=['addvals', 'CDO_toCF', 'chdimname', 'changevartype', 'checkallvars',     \
-  'checkAllValues', 'checkNaNs',                                                     \
+operations=['addVar', 'addvals', 'CDO_toCF', 'chdimname', 'changevartype',           \
+  'checkallvars', 'checkAllValues', 'checkNaNs',                                     \
   'chgtimestep', 'chvarname', 'cleaning_varsfile', 'compute_deaccum',                \
   'compute_opersvarsfiles',                                                          \
@@ -165,7 +172,8 @@
   'netcdf_fold_concatenation_HMT', 'reproject', 'Partialmap_Entiremap',              \
   'Partialmap_EntiremapFor', 'Partialmap_EntiremapForExact',                         \
-  'pinterp', 'remapnn',                                                              \
+  'pinterp', 'remapnn', 'rm_FillValue',                                              \
   'seasmean', 'sellonlatbox', 'sellonlatlevbox', 'selvar', 'setvar_asciivalues',     \
-  'sorttimesmat', 'spacemean', 'SpatialWeightedMean', 'statcompare_files',           \
+  'setvar_nc', 'sorttimesmat', 'spacemean', 'SpatialWeightedMean',                   \
+  'statcompare_files',                                                               \
   'subbasin', 'submns', 'subyrs', 'TimeInf', 'time_reset',                           \
   'TimeSplitmat', 'timemean', 'valmod', 'valmod_dim','varaddattrk', 'varaddattr',    \
@@ -249,5 +257,7 @@
     quit(-1)
 
-if oper == 'addvals':
+if oper == 'addVar':
+    ncvar.addVar(opts.values, opts.ncfile, opts.varname)
+elif oper == 'addvals':
     ncvar.addvals(opts.values, opts.ncfile, opts.varname)
 elif oper == 'CDO_toCF':
@@ -384,4 +394,6 @@
 elif oper == 'reproject':
     ncvar.reproject(opts.values, opts.ncfile, opts.varname)
+elif oper == 'rm_FillValue':
+    ncvar.rm_FillValue(opts.values, opts.ncfile, opts.varname)
 elif oper == 'seasmean':
     ncvar.seasmean(timename, opts.ncfile, opts.varname)
@@ -394,4 +406,6 @@
 elif oper == 'setvar_asciivalues':
     ncvar.setvar_asciivalues(opts.values, opts.ncfile, opts.varname)
+elif oper == 'setvar_nc':
+    ncvar.setvar_nc(opts.values, opts.ncfile, opts.varname)
 elif oper == 'sorttimesmat':
     ncvar.sorttimesmat(opts.ncfile, opts.varname)
