- Timestamp:
- Jun 12, 2016, 11:03:48 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r823 r824 14927 14927 14928 14928 Lncfile = len(ncfile) 14929 filen = ncfile[Lncfile-10:Lncfile] 14930 14931 if filen == 'routing.nc': 14929 14930 if ncfile[Lncfile-10:Lncfile] == 'routing.nc': 14932 14931 lonname = 'nav_lon' 14933 14932 latname = 'nav_lat' … … 14935 14934 Soutflows = ['1: N', '2: NE', '3: E', '4: SE', '5: S', '6: SW', '7: W', \ 14936 14935 '8: NW', '97: sub-basin', '98: small to sea', '99: large to sea'] 14936 filen = 'routing.nc' 14937 14937 else: 14938 14938 print errormsg … … 14947 14947 lons = olons[:] 14948 14948 lats = olats[:] 14949 outflows = ooutflows[:]14949 outflows = np.array(ooutflows[:], dtype=int) 14950 14950 14951 14951 difflonlat = np.sqrt((lons - sublon)**2 + (lats - sublat)**2) 14952 14952 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 14953 14960 isub = gen.index_mat(difflonlat, mindifflonlat) 14954 14961 print ' ' + fname + "initial point of subbasin '" + subname + "' in the " + \ 14955 'matrix:', isub , 'mindiff:', mindifflonlat14962 'matrix:', isub 14956 14963 14957 14964 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) 14958 14979 14959 14980 onewnc = NetCDFFile(ofile, 'w')
Note: See TracChangeset
for help on using the changeset viewer.