Changeset 817 in lmdz_wrf for trunk


Ignore:
Timestamp:
Jun 12, 2016, 2:26:48 PM (8 years ago)
Author:
lfita
Message:

Working version 1.0 of `bassins'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r814 r817  
    1485414854
    1485514855def lonlatvarsFile(lonvals,latvals,dnx,dny,oLlnc):
    14856     """ Functino to CF-define the longitudes and latitudes variables within a file
     14856    """ Function to CF-define the longitudes and latitudes variables within a file
    1485714857      lonvals= 2D matrix with longitudes
    1485814858      latvals= 2D matrix with latitudes
     
    1494214942    outflows = ooutflows[:]
    1494314943
    14944     onc.close()
    14945 
    1494614944    difflonlat = np.sqrt((lons - sublon)**2 + (lats - sublat)**2)
    1494714945    mindifflonlat = np.min(difflonlat)
     
    1502115019        Ngrid = len(grids)
    1502215020        newvar[isub] = Ngrid
    15023         print '  ' + fname + 'Lluis; isub:', isub,'subf:',subf,'grids:',grids,'Ngrid',Ngrid
     15021#        print '  ' + fname + ' Lluis; isub:', isub,'subf:',subf,'grids:',grids,'Ngrid',Ngrid
    1502415022        for igrid in range(Ngrid):
    1502515023            jigrid = subflowspt[grids[igrid]]
    1502615024            lonv = lons[jigrid[0],jigrid[1]]
    1502715025            latv = lats[jigrid[0],jigrid[1]]
    15028             newvarlon[igrid,isub] = lonv
    15029             newvarlat[igrid,isub] = latv
     15026#            print '    jigrid:', jigrid,' lon:', lonv,'lat:',latv
     15027            newvarlon[isub,igrid] = lonv
     15028            newvarlat[isub,igrid] = latv
    1503015029        isub = isub + 1
     15030    onewnc.sync()
     15031
     15032# Global attributes
     15033    onewnc.setncattr('script',  fname)
     15034    onewnc.setncattr('version',  '1.0')
     15035    onewnc.setncattr('author',  'L. Fita')
     15036    newattr = set_attributek(onewnc, 'institution', unicode('Laboratoire de M' +     \
     15037      unichr(233) + 't' + unichr(233) + 'orologie Dynamique'), 'U')
     15038    onewnc.setncattr('university',  'Pierre et Marie Curie')
     15039    onewnc.setncattr('country',  'France')
     15040    for attrs in onc.ncattrs():
     15041        attrv = onc.getncattr(attrs)
     15042        attr = set_attribute(onewnc, attrs, attrv)
     15043
     15044    onc.close()
    1503115045    onewnc.sync()
    1503215046    onewnc.close()
Note: See TracChangeset for help on using the changeset viewer.