Changeset 2196 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Oct 18, 2018, 7:17:53 PM (6 years ago)
Author:
lfita
Message:

Adding number of grid points used in `compute_slice2Dstats'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r2195 r2196  
    2633826338
    2633926339        newvard = ['slice_'+varn2,'slice_'+varn1]
     26340        newvarN = onewnc.createVariable(varn+'Nsliced', 'f', tuple(newvard),         \
     26341          fill_value=gen.fillValueF)
     26342        basicvardef(newvarN, varn+'Nsliced','number of values in slice of ' + varn + \
     26343          'sliced by '+varn1+' & '+varn2, vu)
     26344        add_varattrs(onc, onewnc, [varn], [varn+'Nsliced'])
     26345
    2634026346        newvarn = onewnc.createVariable(varn+'minsliced', 'f', tuple(newvard),        \
    2634126347          fill_value=gen.fillValueF)
     
    2636226368        add_varattrs(onc, onewnc, [varn], [varn+'stdsliced'])
    2636326369
     26370        newvarN[:] = np.sum(~manewvar.mask, axis=tuple(np.arange(vrank) + 2))
    2636426371        newvarn[:] = np.min(manewvar, axis=tuple(np.arange(vrank) + 2))
    2636526372        newvarx[:] = np.max(manewvar, axis=tuple(np.arange(vrank) + 2))
     
    2639426401#compute_slice2Dstats(values, '/home/lluis/PY/wrfout_d01_1995-01-01_00:00:00', 'T2,Q2')
    2639526402
     26403def same_delat_sign(values, ncfile, variable):
     26404    """ Function to determine if a given series of 1D values share the same sign of
     26405         increase/decrease between consecutive values
     26406      values= [slicedims], values to the dimensions to perform a slice of variables
     26407        [slicedims]: '|' separated list of [dimname]:[valdim]
     26408        [valdim]:
     26409          * [integer]: which value of the dimension
     26410          * -1: all along the dimension
     26411          * -9: last value of the dimension
     26412          * [beg]@[end]@[freq] slice from [beg] to [end] every [freq]
     26413          * NOTE, no dim name all the dimension size
     26414      ncfile= netCDF file to use
     26415      variable: ',' list of variables ('all' for all variables)
     26416    """
     26417    fname = 'same_delat_sign'
     26418
     26419    if values == 'h':
     26420        print fname + '_____________________________________________________________'
     26421        print same_delat_sign.__doc__
     26422        quit()
     26423
     26424    expectargs = 'varn1,minvar1,maxvar1,slcevar1,varn2,minvar2,maxvar2,slcevar2,' +  \
     26425      'dimvars'
     26426    gen.check_arguments(fname, values, expectargs, ',')
     26427
     26428    varn1 = values.split(',')[0]
     26429    minvar1 = np.float(values.split(',')[1])
     26430
     26431    return
     26432
    2639626433#quit()
    2639726434
Note: See TracChangeset for help on using the changeset viewer.