Changeset 1749 in lmdz_wrf


Ignore:
Timestamp:
Dec 17, 2017, 4:45:04 PM (8 years ago)
Author:
lfita
Message:

Final version:

  • Adding year attribution as argument
  • Adding time-units
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/ORforcing_reconstruct.py

    r1748 r1749  
    1212import subprocess as sub
    1313import module_ForSci as Sci
    14 
    15 filen = 'cruncep_halfdeg_1950.nc'
     14from optparse import OptionParser
     15
     16parser = OptionParser()
     17parser.add_option("-y", "--year", dest="year", help="year to process",               \
     18  metavar="VALUE")
     19
     20(opts, args) = parser.parse_args()
     21
     22####### ###### ##### #### ### ## #
     23
     24filen = 'cruncep_halfdeg_' + opts.year + '.nc'
    1625
    1726# Variable whcih provides the indices of a 1D vector from the dimy, dimx space
     
    5362availProj = ['latlon']
    5463
    55 ofilen = 'reconstruct_matrix.nc'
     64ofilen = 'reconstruct_matrix_' + opts.year + '.nc'
    5665
    5766ncvars = onc.variables.keys()
     
    260269onewnc.sync()
    261270ncvar.add_global_PyNCplot(onewnc, main, fname, '0.1')
    262 
    263271onc.close()
     272
     273# Reconstructing times
     274otime = onewnc.variables['time']
     275ncvar.set_attribute(otime, 'units', 'seconds since ' + opts.year + '-01-01 00:00:00')
     276
    264277onewnc.sync()
    265278onewnc.close()
    266279
    267 print fname + ": Successful writing of file 'reconstruct_matrix.nc' !!"
     280print fname + ": Successful writing of file '" + ofilen + ".nc' !!"
Note: See TracChangeset for help on using the changeset viewer.