Changeset 1737 in lmdz_wrf


Ignore:
Timestamp:
Dec 16, 2017, 7:15:39 PM (7 years ago)
Author:
lfita
Message:

Adding user providing resolution on `reconstruct_matrix_from_vector'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r1736 r1737  
    2069720697    """ Function to reconstruct a 2D matrix from a pair of syncronized vectors with
    2069820698      the positions on x and y coordinates
    20699         values=[varXpos]:[varYpos]:[Xmin]:[Xmax]:[Ymin]:[Ymax]:[matProj]:[maxdiff]
     20699        values=[varXpos]:[varYpos]:[Xmin]:[Xmax]:[Ymin]:[Ymax]:[matProj]:[resX]:[resY]:[maxdiff]
    2070020700          [varXpos]: variable with the vector of X positions
    2070120701          [varYpos]: variable with the vector of Y positions
     
    2070620706          [matProj]: assumed projection of the final matrix
    2070720707            'latlon': regular lon/lat projection
     20708          [resX]: resolution along the x-axis (to be interpreted according to the projection)
     20709          [resY]: resolution along the y-axis (to be interpreted according to the projection)
    2070820710          [maxdiff]: maximum allowed distance between matrix grid point and vector location
    2070920711        ncfile= netCDF file to use
     
    2072120723
    2072220724    expectargs = '[varXpos]:[varYpos]:[Xmin]:[Xmax]:[Ymin]:[Ymax]:[matProj]:' +      \
    20723       '[maxdiff]'
     20725      '[resX]:[resY]:[maxdiff]'
    2072420726    gen.check_arguments(fname, values, expectargs, ':')
    2072520727
     
    2073420736        Xmin = values.split(':')[2]
    2073520737    matProj = values.split(':')[6]
    20736     maxdiff = np.float(values.split(':')[7])
     20738    resX = np.float(values.split(':')[7])
     20739    resY = np.float(values.split(':')[8])
     20740    maxdiff = np.float(values.split(':')[9])
    2073720741
    2073820742    if not gen.searchInlist(availProj, matProj):
     
    2079920803    # Matrix values
    2080020804    if matProj == 'latlon':
    20801         ddx = xposv[1]- xposv[0]
    20802         ddy = yposv[1]- yposv[0]
    20803         dimx = (Xmax - Xmin+ddx)/ddx
    20804         dimy = (Ymax - Ymin+ddy)/ddy
     20805        dimx = (Xmax - Xmin+resX)/resX
     20806        dimy = (Ymax - Ymin+resY)/resY
    2080520807
    2080620808    print dir(Sci)
Note: See TracChangeset for help on using the changeset viewer.