- Timestamp:
- Jun 12, 2016, 2:26:48 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r814 r817 14854 14854 14855 14855 def lonlatvarsFile(lonvals,latvals,dnx,dny,oLlnc): 14856 """ Functi noto CF-define the longitudes and latitudes variables within a file14856 """ Function to CF-define the longitudes and latitudes variables within a file 14857 14857 lonvals= 2D matrix with longitudes 14858 14858 latvals= 2D matrix with latitudes … … 14942 14942 outflows = ooutflows[:] 14943 14943 14944 onc.close()14945 14946 14944 difflonlat = np.sqrt((lons - sublon)**2 + (lats - sublat)**2) 14947 14945 mindifflonlat = np.min(difflonlat) … … 15021 15019 Ngrid = len(grids) 15022 15020 newvar[isub] = Ngrid 15023 print ' ' + fname + 'Lluis; isub:', isub,'subf:',subf,'grids:',grids,'Ngrid',Ngrid15021 # print ' ' + fname + ' Lluis; isub:', isub,'subf:',subf,'grids:',grids,'Ngrid',Ngrid 15024 15022 for igrid in range(Ngrid): 15025 15023 jigrid = subflowspt[grids[igrid]] 15026 15024 lonv = lons[jigrid[0],jigrid[1]] 15027 15025 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 15030 15029 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() 15031 15045 onewnc.sync() 15032 15046 onewnc.close()
Note: See TracChangeset
for help on using the changeset viewer.