corca=vdic['ORCA'], lkcont=False, cfignm=path_fig+'dS_annual_'+cdepth+'_'+CONFEXP+'_-_'+CC, cbunit='PSU', cfig_type=fig_type, ctitle='Salinity diff. to "'+cname_obs+'" at '+cdepth_true+', '+CONFEXP+' ('+cy1+'-'+cy2+')', lforce_lim=True) del Sobs_JFM, Sobs_JAS if l_do_monthly_3d: del Tnemo_JFM, Tnemo_JAS, Snemo_JFM, Snemo_JAS, Tobs_JFM, Tobs_JAS # Temperature and salinity for vertical sections if lfig2 and i_do_sect==1 and (l_do_monthly_3d or l_3df_are_annual): vdico = bt.check_env_var(sys.argv[0], {'TS_SECTION_FILE'}) vboxes, vlon1, vlat1, vlon2, vlat2, vTmin, vTmax, vSmin, vSmax = bt.read_coor(vdico['TS_SECTION_FILE'], ctype='float', lTS_bounds=True) js = 0 for csname in vboxes: [ i1, i2, j1, j2 ] = bo.transect_zon_or_med(vlon1[js], vlon2[js], vlat1[js], vlat2[js], xlon, xlat) if i2>i1 and i2 < ni0-1: i2 = i2+1 if j2>j1 and j2 < nj0-1: j2 = j2+1 print '\n *** Section: '+csname+':' print ' lon1, lon2, lat1, lat2 =', vlon1[js], vlon2[js], vlat1[js], vlat2[js] print ' => i1, i2, j1, j2 =', i1, i2, j1, j2 #print ' xlon[j1,i1], xlon[j1,i2] =', xlon[j1,i1]-360., xlon[j1,i2] print '' if i1 > i2: print 'ERROR (temp_sal.py) => i1 > i2 !'; sys.exit(0)
cf_mm = sys.argv[2] # Opening mesh_mask: f_mm = Dataset(cf_mm) Xlon = f_mm.variables['glamt'][0, :, :] Xlat = f_mm.variables['gphit'][0, :, :] mask = f_mm.variables['tmask'][0, 0, :, :] f_mm.close() (nj, ni) = nmp.shape(Xlon) nmask = nmp.zeros((nj, ni)) # Getting sections: vboxes, vlon1, vlat1, vlon2, vlat2 = bt.read_coor(cf_tf, ctype='float', lTS_bounds=False) js = -1 for csname in vboxes: js = js + 1 print '\n *** ' + sys.argv[0] + ': treating section ' + csname nmask[:, :] = mask[:, :] (i1, i2, j1, j2) = bo.transect_zon_or_med(vlon1[js], vlon2[js], vlat1[js], vlat2[js], Xlon, Xlat)
print 'Nt, nk, nj, ni =', Nt, nk, nj, ni # Masking: for jt in range(Nt): XT[jt, :, :, :] = rmsk[:, :, :] * XT[jt, :, :, :] + ( 1. - rmsk[:, :, :]) * -9999. XS[jt, :, :, :] = rmsk[:, :, :] * XS[jt, :, :, :] + ( 1. - rmsk[:, :, :]) * -9999. vtime = nmp.zeros(Nt) for jt in range(Nt): vtime[jt] = float(jyear) + (float(jt) + 0.5) / float(Nt) # Getting sections: vboxes, vlon1, vlat1, vlon2, vlat2 = bt.read_coor(f_sections, ctype='float', lTS_bounds=False) js = -1 for csname in vboxes: js = js + 1 print '\n *** ' + sys.argv[0] + ': treating section ' + csname (i1, i2, j1, j2) = bo.transect_zon_or_med(vlon1[js], vlon2[js], vlat1[js], vlat2[js], xlon, xlat) print csname + ' :' print '(lon1, lon2, lat1, lat2) =', vlon1[js], vlon2[js], vlat1[js], vlat2[ js]
cyear = sys.argv[2] ; jyear = int(cyear); cyear = '%4.4i'%jyear print 'Current year is '+cyear+' !\n' # Vector containing the different z_crit: vMLD_crit = [] vv = vdic['MLD_CRIT'].split(',') for cv in vv: vMLD_crit.append(float(cv)) print "\n All the z_crit to use:", vMLD_crit[:] # First will read name and coordinates of rectangular boxes to treat into file FILE_DMV_BOXES ############################################################################################## vboxes, vi1, vj1, vi2, vj2 = bt.read_coor(vdic['FILE_DMV_BOXES']) nbb = len(vboxes) print '' bt.chck4f(vdic['MM_FILE']) id_mm = Dataset(vdic['MM_FILE']) zmask_orca = id_mm.variables['tmask'][0,0,:,:] ze1t_orca = id_mm.variables['e1t'] [0,:,:] ze2t_orca = id_mm.variables['e2t'] [0,:,:] id_mm.close() bt.chck4f(cf_in) id_in = Dataset(cf_in) Xmld_orca = id_in.variables[vdic['NN_MLD']][:,:,:]
print 'nt, nj, ni =', nt, nj, ni vtime = nmp.zeros(nt) for jt in range(nt): vtime[jt] = float(jyear) + (float(jt) + 0.5)/float(nt) # First will read name and coordinates of rectangular boxes to treat into file 'FILE_DEF_BOXE' ############################################################################################## vboxes, vi1, vj1, vi2, vj2 = bt.read_coor(vdic['FILE_DEF_BOXE']) nbb = len(vboxes) print '' rmean_sst = nmp.zeros((nt,nbb)) rmean_sss = nmp.zeros((nt,nbb)) for jb in range(nbb): cbox = vboxes[jb] ; print '\n *** Focus on '+cbox+' box' i1 = vi1[jb] j1 = vj1[jb] i2 = vi2[jb]+1 j2 = vj2[jb]+1