Changeset 1698 in lmdz_wrf for trunk/tools/get_stations.py


Ignore:
Timestamp:
Dec 8, 2017, 1:51:42 PM (7 years ago)
Author:
lfita
Message:

Adding creation of 4D pressure variable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/get_stations.py

    r1694 r1698  
    394394    dimvarvalues[dimvariables['lon']] = newXvarvals
    395395    dimvarvalues[dimvariables['lat']] = newYvarvals
     396    dx = newXvarvals.shape[1]
     397    dy = newXvarvals.shape[0]
     398
     399# Looking for 4D 'plev' variable for calculation of diagnostics
     400Zvarvals = dimvarvalues[dimvariables['plev']]
     401Tvarvals = dimvarvalues[dimvariables['time']]
     402if len(Zvarvals.shape) == 1:
     403    dz = Zvarvals.shape[0]
     404    dt = Tvarvals.shape[0]
     405    newZvarvals = np.zeros((dt, dz, dy, dx), dtype=np.float)
     406    for it in range(dt):
     407        for iy in range(dy):
     408            for ix in range(dx):
     409                newZvarvals[it,:,iy,ix] = Zvarvals
     410    dimvarvalues[dimvariables['plev']] = newZvarvals
    396411
    397412# Retrieving surface data
Note: See TracChangeset for help on using the changeset viewer.