Changeset 713 in lmdz_wrf
- Timestamp:
- Apr 25, 2016, 6:37:18 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r712 r713 18770 18770 def Partialmap_Entiremap(values, filen, varn): 18771 18771 """ Function to transform from a partial global map (e.g.: only land points) to an entire one 18772 values= [lonmame],[latname],[fillVal],[resolution],[kind],[lonlatProjfile] 18772 Coincidence of points is done throughout a first guess from fractions of the total domain of search 18773 values= [lonmame],[latname],[fillVal],[resolution],[kind],[lonlatProjfile],[fracd] 18773 18774 [lonname]: name of the longitude variable 18774 18775 [latname]: name of the latitude variable … … 18785 18786 'Goode': Goode projection 18786 18787 [lonlatProjfile]: file with the lon,lat of the desired projection. 'None' to be computed and written on fly 18788 [fracd]: Percentage of the fractions within perform the first guess search 18787 18789 filen= name of the netCDF file 18788 18790 varn= name of the variable … … 18798 18800 quit() 18799 18801 18800 arguments = '[lonmame],[latname],[fillVal],[resolution],[kind],[lonlatProjfile]' 18802 arguments = '[lonmame],[latname],[fillVal],[resolution],[kind],' + \ 18803 '[lonlatProjfile],[fracd]' 18801 18804 check_arguments(fname, values, arguments, ',') 18802 18805 … … 18816 18819 kind = values.split(',')[4] 18817 18820 Projfile = values.split(',')[5] 18821 fracd = np.float(values.split(',')[6]) 18822 18818 18823 if Projfile == 'None': 18819 18824 lonlatProjfile = None … … 18974 18979 else: 18975 18980 newvar = newnc.createVariable('lon','f8',('lon')) 18976 basicvardef(newvar, 'lon', 'Longitudes','degrees 18981 basicvardef(newvar, 'lon', 'Longitudes','degrees_East') 18977 18982 newvar[:] = lonmap 18978 18983 newvar.setncattr('axis', 'X') … … 18983 18988 else: 18984 18989 newvar = newnc.createVariable('lat','f8',('lat')) 18985 basicvardef(newvar, 'lat', 'Latitudes','degrees 18990 basicvardef(newvar, 'lat', 'Latitudes','degrees_North') 18986 18991 newvar[:] = latmap 18987 18992 newvar.setncattr('axis', 'Y') … … 19033 19038 # print fraclat 19034 19039 19040 # Reducing the searching points 19041 newvarinvals = newvarinpt[:] 19042 maskpt = np.where(newvarinvals.mask == True, False, True) 19043 points = np.arange(Ninpts) 19044 mapoints = ma.array(points, mask=maskpt) 19045 ptsf = mapoints.compressed() 19046 19047 Nptsf = len(ptsf) 19048 print Ninpts,'Npoints to find:', len(ptsf), ptsf[0:10], newvarindiff[ptsf[0:10]] 19035 19049 # Error at 150024, 150025, 151709, 153421 19036 print ' ' + fname + ': re-locating:',Ninpts,'points...'19050 print ' ' + fname + ': from:', Ninpts,'re-locating:',Nptsf,'points...' 19037 19051 if kind == 'Goode': 19038 for iv in range(150024,Ninpts): 19052 for iv0 in range(Nptsf): 19053 iv = mapoints[ptsf[iv0]] 19039 19054 if newvarinpt[iv] == 0: 19040 19055 … … 19042 19057 # mindiffLl = np.min(difflonlat) 19043 19058 # ilatlon = index_mat(difflonlat, mindiffLl) 19044 ilatlon, mindiffLl = CoarselonlatFind(projlon,projlat,lonvs[iv],latvs[iv], .1)19059 ilatlon, mindiffLl = CoarselonlatFind(projlon,projlat,lonvs[iv],latvs[iv],fracd) 19045 19060 19046 19061 # if ilatlon[0] != ilatlon2[0] or ilatlon[1] != ilatlon2[1]: … … 19095 19110 quit(-1) 19096 19111 19097 if np.mod(iv,100 ) == 0:19112 if np.mod(iv,1000) == 0: 19098 19113 newnc.sync() 19099 19114 # print ' ' + fname + 'values localized:', newvar[:].compressed()
Note: See TracChangeset
for help on using the changeset viewer.