Changeset 2173 in lmdz_wrf for trunk


Ignore:
Timestamp:
Oct 9, 2018, 8:19:21 PM (7 years ago)
Author:
lfita
Message:

Using right indices!!!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r2169 r2173  
    2595425954          str(stlats[ist]))
    2595525955        stdataij[stns[ist]] = [ijst, dst]
    25956         dlon = lon[ijst[0],ijst[1]]
    25957         dlat = lat[ijst[0],ijst[1]]
     25956        dlon = lon[ijst[1],ijst[0]]
     25957        dlat = lat[ijst[1],ijst[0]]
    2595825958
    2595925959        # Writing in file station values from grid
    25960         newvari[ist] = ijst[1]
    25961         newvarj[ist] = ijst[0]
     25960        newvari[ist] = ijst[0]
     25961        newvarj[ist] = ijst[1]
    2596225962        newvarlon[ist] = dlon
    2596325963        newvarlat[ist] = dlat
     
    2597125971            weights = np.ones((1), dtype=np.float)
    2597225972        elif method == 'mean' or method == 'dist':
    25973             ddx = lon[ijst[0],ijst[1]+1] - dlon
    25974             ddy = lat[ijst[0]+1,ijst[1]] - dlat
     25973            ddx = lon[ijst[1],ijst[0]+1] - dlon
     25974            ddy = lat[ijst[1]+1,ijst[0]] - dlat
    2597525975            signx = np.abs(ddx)/ddx
    2597625976            signy = np.abs(ddy)/ddy
     
    2598225982 
    2598325983            # Avoiding outside shape
    25984             xij = np.min([ijst[1]+incx, ddimx-1])
    25985             yij = np.min([ijst[0]+incy, ddimy-1])
     25984            xij = np.min([ijst[0]+incx, ddimx-1])
     25985            yij = np.min([ijst[1]+incy, ddimy-1])
    2598625986            xij = int(np.max([0, xij]))
    2598725987            yij = int(np.max([0, yij]))
    2598825988
    2598925989            ptvslice.append(ijst)
    25990             ptvslice.append([ijst[0],xij])
    25991             ptvslice.append([yij,ijst[1]])
     25990            ptvslice.append([ijst[1],xij])
     25991            ptvslice.append([yij,ijst[0]])
    2599225992            ptvslice.append([yij,xij])
    2599325993
Note: See TracChangeset for help on using the changeset viewer.