Changeset 824 in lmdz_wrf for trunk


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

Adding 2 new errors:

  • When there is only one grid in all the sub-basin
  • When there is not coincidence (distance zero) with any grid point from the file
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r823 r824  
    1492714927
    1492814928    Lncfile = len(ncfile)
    14929     filen = ncfile[Lncfile-10:Lncfile]
    14930 
    14931     if filen == 'routing.nc':
     14929
     14930    if ncfile[Lncfile-10:Lncfile] == 'routing.nc':
    1493214931        lonname = 'nav_lon'
    1493314932        latname = 'nav_lat'
     
    1493514934        Soutflows = ['1: N', '2: NE', '3: E', '4: SE', '5: S', '6: SW', '7: W',      \
    1493614935          '8: NW', '97: sub-basin', '98: small to sea', '99: large to sea']
     14936        filen = 'routing.nc'
    1493714937    else:
    1493814938        print errormsg
     
    1494714947    lons = olons[:]
    1494814948    lats = olats[:]
    14949     outflows = ooutflows[:]
     14949    outflows = np.array(ooutflows[:], dtype=int)
    1495014950
    1495114951    difflonlat = np.sqrt((lons - sublon)**2 + (lats - sublat)**2)
    1495214952    mindifflonlat = np.min(difflonlat)
     14953    if mindifflonlat != 0.:
     14954        print errormsg
     14955        print '  ' + fname + ': wrong initial lon,lat of the basin!!'
     14956        print '    for lon,lat:', sublon,',',sublat,'there is not grid point ' +     \
     14957          "coincidence in file '" + ncfile + "'"
     14958        quit(-1)
     14959
    1495314960    isub = gen.index_mat(difflonlat, mindifflonlat)
    1495414961    print '    ' + fname + "initial point of subbasin '" + subname + "' in the " +   \
    14955       'matrix:', isub, 'mindiff:', mindifflonlat
     14962      'matrix:', isub
    1495614963
    1495714964    masksubbasin, subflows, subflowspt = gen.subbasin_point(outflows, isub)
     14965
     14966    if len(subflows.keys()) == 1:
     14967        print errormsg
     14968        print '  ' + fname + ": Only 1 point for subbasin '" + subname +             \
     14969          "' at lon,lat:", sublon,',',sublat
     14970        print ' values around (3x3 centered at: ', isub, ')'
     14971        lon3x3 = gen.vals_around(lons, isub)
     14972        lat3x3 = gen.vals_around(lats, isub)
     14973        out3x3 = gen.vals_around(outflows, isub)
     14974        print ' lon lat out _______'
     14975        for i in range(3):
     14976            print lon3x3[i,:], lat3x3[i,:], out3x3[i,:]
     14977        print 'out equivalencies:', Soutflows
     14978        quit(-1)
    1495814979
    1495914980    onewnc = NetCDFFile(ofile, 'w')
Note: See TracChangeset for help on using the changeset viewer.