Changeset 2417 in lmdz_wrf


Ignore:
Timestamp:
Mar 25, 2019, 4:05:16 PM (6 years ago)
Author:
lfita
Message:

Adding fix for Nmaxgrisin == 1 in `usefile_compute_slices_stats_areaweighted'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r2416 r2417  
    3068230682
    3068330683    # removing monotones. Fortran only accepts rank <= 7 arrays !!
     30684    Nmaxgridsinone = False
     30685    if sin.shape[1] == 1: Nmaxgridsinone = True
     30686
    3068430687    sN, Ndims = gen.remove_monotones(sN, osN.dimensions)
    3068530688    sin, indims = gen.remove_monotones(sin, osin.dimensions)
     
    3068930692    dimsslice = list(Ndims)
    3069030693    shapeslice = list(sN.shape)
     30694
     30695    # Due to the removal of monotones we are losing the cases when Nmaxgrisin == 1
     30696    if Nmaxgridsinone:
     30697        print warnmsg
     30698        print '  ' + fname + ": maximum number of grid points per slice == 1 !!"
     30699        print '    adjusting accordingly certain matrices ...'
     30700        shapein = list(sin.shape)
     30701        Lshape = len(shapein)
     30702        reshapein = [shapein[0]] + [1] + shapein[1:Lshape+1]
     30703
     30704        sin0 = sin + 0
     30705
     30706        newsin = np.zeros(tuple(reshapein), dtype=int)
     30707        for i in range(shapein[0]):
     30708            newsin[i,0,...] = sin[i,...]
     30709
     30710        sin = None
     30711        sin = newsin+ 0
    3069130712
    3069230713    sNt = sN.transpose()
Note: See TracChangeset for help on using the changeset viewer.