Changeset 916 in lmdz_wrf for trunk


Ignore:
Timestamp:
Jun 20, 2016, 8:54:53 PM (8 years ago)
Author:
lfita
Message:

Adding `-9' for the last value in 'SliceVarDict?'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r913 r916  
    89648964            * [integer]: which value of the dimension
    89658965            * -1: all along the dimension
     8966            * -9: last value along the dimension
    89668967            * [beg]:[end] slice from [beg] to [end]
    89678968            NOTE: that dimension of the variables which not appear al values will be used
     
    91269127            objnewnc.sync()
    91279128   
     9129    # Statistics of the variable dimension along the dimensions operated
     9130    basicoper = ['min', 'max', 'menan', 'mean2', 'sum']
     9131
    91289132# operating variable dimension
    91299133    print '  ' + fname + ': Opering slice of variable dimension _______'
     
    92219225            objnewnc.sync()
    92229226
     9227            # Statistics of the variable dimension along the dimensions operated
     9228            for op in basicoper:
     9229                if op != operkind:
     9230                    finalvarv, finalds = operdim(varvals,varsliceddims,dimsoper,op)
     9231                    if varinf.FillValue is not None:
     9232                        newvar = objnewnc.createVariable(vn+op, nctype(varinf.dtype),\
     9233                          tuple(finalds), fillValue=varinf.FillValue)
     9234                    else:
     9235                        newvar = objnewnc.createVariable(vn+op, nctype(varinf.dtype),\
     9236                          tuple(finalds))
     9237                    newNvar = newNvar + 1
     9238                    newvar[:] = finalvarv[:]
     9239                    newattr = basicvardef(newvar, stdname + op, lname + ' '+ op +    \
     9240                      ' along ' + dimsoperS, uname)
     9241            objnewnc.sync()
     9242
    92239243# Including operation dimensions on the new slice for the variables dimension
    92249244#   but, which value along the operated dimension should be taken?
     
    92679287                attrv = ov.getncattr(attrn)
    92689288                newattr = set_attribute(newvar, attrn, attrv)
    9269 #            LLUIS
    92709289            objnewnc.sync()
    9271 
    92729290
    92739291# global attributes
     
    1334413362        slicedict[dimn] = [value]
    1334513363          [value] = -1, all the values
     13364          [value] = -9, last values
    1334613365          [value] = int, a single value
    1334713366          [value] = [beg, end, frq], from a beginning to an end with a given frequency
     
    1336613385                if dictv == -1:
    1336713386                    slicevals.append(slice(0,varshape[idim]))
     13387                    slicefinaldims.append(dim)
     13388                elif dictv == -9:
     13389                    slicevals.append(varshape[idim]-1)
    1336813390                    slicefinaldims.append(dim)
    1336913391                else:
Note: See TracChangeset for help on using the changeset viewer.