Changeset 1472 in lmdz_wrf


Ignore:
Timestamp:
Mar 28, 2017, 11:19:04 PM (8 years ago)
Author:
lfita
Message:

Improving `netcdf_fold_concatenation_HMT':

  • Including list of files
  • Including PyNCplot global attributes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r1467 r1472  
    72297229    fname='compute_opervartimes'
    72307230
    7231     ofile = 'opervartimes_' + varname + '.nc'
    7232 
    72337231    if values == 'h':
    72347232        print fname + '_____________________________________________________________'
    7235         print opervartimes.__doc__
     7233        print compute_opervartimes.__doc__
    72367234        quit()
     7235
     7236    ofile = 'opervartimes_' + varname + '.nc'
    72377237
    72387238    if not os.path.isfile(ncfile):
     
    1060410604    """
    1060510605    import subprocess as sub
    10606     fname='netcdf_fold_concatenate_HMT'
     10606    fname='netcdf_fold_concatenation_HMT'
    1060710607
    1060810608    ofile = 'netcdf_fold_concatenated_HMT.nc'
     
    1062310623    if Nfiles == 0:
    1062410624        print errormsg
    10625         print '  ' + fname + ": there are no files as '" + fold + '/' + ncfile + "*' !!"
     10625        print '  ' +fname+ ": there are no files as '" + fold + '/' + '*'.join(HMT) +\
     10626          "*' !!"
    1062610627        quit(-1)
    1062710628    print confiles
     
    1063110632    for filen in confiles:
    1063210633        print 'charging: ',filen
    10633         ncobjs.append(NetCDFFile(fold + '/' + filen, 'r'))
     10634        if filen.find(fold) != -1:
     10635            ncobjs.append(NetCDFFile(filen, 'r'))
     10636        else:
     10637            ncobjs.append(NetCDFFile(fold + '/' + filen, 'r'))
    1063410638
    1063510639# Looking for the new length of the concatenation dimension
     
    1065610660    else:
    1065710661        newnc.createDimension(condim, totcondim)
     10662    newnc.createDimension('file', Nfiles)
     10663    newnc.createDimension('Lstring', 256)
     10664
     10665    # dim-variables
     10666    newvar = newnc.createVariable('file','c',('file','Lstring'))
     10667    newvals = writing_str_nc(newvar, confiles, 256)
     10668    if confiles[0].find(fold) != -1:
     10669        str="concatenated files following dimension '" + condim + "'"
     10670    else:
     10671        str="concatenated files from folder '" + fold + "' following dimension '" +  \
     10672          condim + "'"
     10673    vardef = basicvardef(newvar, 'files', str, '-')
     10674
    1065810675# Fake variable for the dimension
    1065910676    print 'condim:',condim
     
    1073510752
    1073610753    newnc.sync()
     10754    add_global_PyNCplot(newnc, main, fname, '1.1')
     10755
    1073710756    newnc.close()
    1073810757
Note: See TracChangeset for help on using the changeset viewer.