Changeset 2416 in lmdz_wrf for trunk


Ignore:
Timestamp:
Mar 25, 2019, 3:51:57 PM (6 years ago)
Author:
lfita
Message:

Fixing when there are Nmaxgridin == 1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r2404 r2416  
    3001130011
    3001230012    # removing monotones. Fortran only accepts rank <= 7 arrays !!
     30013    Nmaxgridsinone = False
     30014    if sin.shape[1] == 1: Nmaxgridsinone = True
     30015
    3001330016    sN, Ndims = gen.remove_monotones(sN, oNslice.dimensions)
    3001430017    sin, indims = gen.remove_monotones(sin, oslicein.dimensions)
     
    3002030023    dimsslice = list(Ndims)
    3002130024    shapeslice = list(sN.shape)
     30025
     30026    # Due to the removal of monotones we are losing the cases when Nmaxgrisin == 1
     30027    if Nmaxgridsinone:
     30028        print warnmsg
     30029        print '  ' + fname + ": maximum number of grid points per slice == 1 !!"
     30030        print '    adjusting accordingly certain matrices ...'
     30031        shapein = list(sin.shape)
     30032        Lshape = len(shapein)
     30033        reshapein = [shapein[0]] + [1] + shapein[1:Lshape+1]
     30034
     30035        sin0 = sin + 0
     30036
     30037        newsin = np.zeros(tuple(reshapein), dtype=int)
     30038        for i in range(shapein[0]):
     30039            newsin[i,0,...] = sin[i,...]
     30040
     30041        sin = None
     30042        sin = newsin+ 0
    3002230043
    3002330044    sNt = sN.transpose()
Note: See TracChangeset for help on using the changeset viewer.