Lonr, Latr = np.meshgrid(lonr, latr) Lonu, Lonv, Lonp = rho2uvp(Lonr) Latu, Latv, Latp = rho2uvp(Latr) M, L = Latp.shape ######################################################################### ## COMPUTING METRICS ######################################################################### print ' \n' + '==> ' + ' COMPUTING METRICS ...\n' + ' ' print ' \n==> LLm = %s ...\n ' %(L-1) print ' \n==> MMm = %s ...\n ' %(M-1) pm, pn, dndx, dmde = get_metrics(Latu, Lonu, Latv, Lonv) xr = 0*pm yr = xr for i in np.arange(0, L): xr[:, i+1] = xr[:, i] + 2 / ( pm[:, i+1] + pm[:, i] ) for j in np.arange(0, M): yr[j+1, :] = yr[j, :] + 2 / ( pn[j+1, :] + pn[j, :] ) xu, xv, xp = rho2uvp(xr) yu, yv, yp = rho2uvp(yr) dx = 1 / pm dy = 1 / pn
out['lat_rho']=lat[:] lonp,latp = UTM2geo(out['x_psi'][:],out['y_psi'][:],myProj) out['lon_psi']=lonp[:] out['lat_psi']=latp[:] lonu,latu = UTM2geo(out['x_u'][:],out['y_u'][:],myProj) out['lon_u']=lonu[:] out['lat_u']=latu[:] lonv,latv = UTM2geo(out['x_v'][:],out['y_v'][:],myProj) out['lon_v']=lonv[:] out['lat_v']=latv[:] ###### Angle and Coriolis ####### out['pm'],out['pn'],out['dndx'],out['dmde']=rl.get_metrics(out['lat_u'],out['lon_u'],out['lat_v'],out['lon_v']) out['f']= CalculateCoriolis(out['lat_rho']) ###### Creating Mask ####### temp = CreateMask(out) out['mask_rho']=temp['mask_rho'] out['mask_psi']=temp['mask_psi'] out['mask_u']=temp['mask_u'] out['mask_v']=temp['mask_v'] out['h'][out['h']<3]=3 ###### Inserting data on NC ####### grd = nc.Dataset('/home/leportella/projects/runs/Run00/scregional_grdv10.nc','r+') InsertGridDimensions(grd,out)