import datetime as DTM # get day before yesterday's date fmt = '%Y%m%d' tday = time.strftime(fmt) dtm0 = DTM.datetime.strptime(tday, fmt) dtm = dtm0 - DTM.timedelta(2) yday = dtm.strftime(fmt) idx = 0 if 1: # scalar plot of concentration vobj = 'fice' else: # plot ice speed with unit vectors showing direction vobj = MR.make_plot_options('uice',\ vec_opt=2,layer=0,conv_fac=1,wave_mask=False,ice_mask=True,dir_from=True) FCdir = os.getenv('TP4_REALTIME_RES') + '/ice_only/' + yday if 1: # binary file jday = int(dtm.strftime('%j')) - 1 # dts = '%4.4i_%3.3i' % (dtm.year, jday) ddir = FCdir + '/bin/' afil = ddir + '/TP4archv.' + dts + '_120000Z.a' print(afil) fobj = MR.HYCOM_binary_info(afil) elif 0: # single-record netcdf ddir = FCdir + '/netcdf/' dts = yday + '_%2.2i' % (dtm.hour) ncfil = ddir + '/TP4archv_' + dts + '.nc'
osdir = '/work/shared/nersc/msc/OSI-SAF/' + wy + '_nh_polstere/' smdir = '/work/shared/nersc/msc/SMOS/netcdf/smos_sea_ice_thickness_v2.1_north/' afiles = ['' + dres + 'TP4DAILY_2015_347_2015_351.a'] #,\ # 'TP4DAILY_2016_010_2016_011.a',\ # 'TP4DAILY_2016_010_2016_011.a',\ # 'TP4DAILY_2016_010_2016_011.a' ] for afil in afiles: # make new diretory for regions fdir = '' + home + '/Figures_' + hycomreg + '' print "fdir: ", fdir if not os.path.exists(fdir): os.makedirs(fdir) vo = mr.make_plot_options('hice', ice_mask=True) vo2 = mr.make_plot_options('fice', ice_mask=True) # fice vs OSI-SAF print "afil: ", afil hi = mr.HYCOM_binary_info(afil) dtm = hi.datetime cdate = dtm.strftime('%Y%m%d') figname = 'comp_OSISAF_' + hycomreg + '_' + cdate + '.png' hi.compare_ice_edge_obs(figname=figname, show='False', HYCOMreg=hycomreg) # only OSI-SAF fice osfil = '' + osdir + 'ice_conc_nh_polstere-100_multi_' + cdate + '1200.nc' print "osfil: ", osfil nci = mr.nc_getinfo(osfil) figname = 'OSISAF_fice_' + hycomreg + '_' + cdate + '.png' #nci.plot_var(vo,show=showfigs,figname=figname) nci.make_png(vo2, show='False', figdir=fdir, HYCOMreg=hycomreg)
'_contours_%Y%m%dT%H%M%SZ.nc') print('\nWriting\n' + ncfil2 + '\n') if TEST_PLOT: if 1: # zoom DC = 'k' #date color #reg = 'gre'# greenland sea reg = 'FR1' # greenland sea figname = ncfil2.replace('.nc', '_' + reg + '.png') else: DC = 'r' reg = 'Arctic' figname = ncfil2.replace('.nc', '.png') print('Saving figure: \n' + figname + '\n') var_opts = MR.make_plot_options(vbl, ice_mask=True) pobj,bmap = nci.plot_var(var_opts,show=False,HYCOMreg=reg,\ date_label=2,date_color=DC,\ clim=[0,1],add_cbar=True,clabel='sea ice concentration') fig = pobj.fig ax = pobj.ax # --------------------------------------------------------------------------- # get the contours print('Getting contours...') V = nci.get_var(vbl, time_index=time_index) if 0: # get vbl range Vmin = V.min() Vmax = V.max()
HYCOMreg = 'TP4' if FCtype != "ice_only": # ============================================================= # wave-ice FC's if scalars: # scalars scalars = [] clabs = {} clims = {} vname = 'dmax' clabs.update({vname: 'Maximum floe size, m'}) clims.update({vname: [0, 300]}) scalars.append(Mr.make_plot_options(vname, ice_mask=True)) for V in scalars: vname = V.name figdir = outdir + '/' + vname if not os.path.exists(figdir): os.mkdir(figdir) nci.make_png_all(V,figdir=figdir,HYCOMreg=HYCOMreg,\ clabel=clabs[vname],clim=clims[vname]) if pairs: # pairs pairs = [] clabs = {} clims = {}
# Area of plot TP4, FR1, BS1, gre, bar, ....? hycomreg = 'TP4' dres = '/work/users/timill/RealTime_Models/results_hindcasts/TP4a0.12/wavesice/analysis/binaries_all/DAILY/' # resdir='/work/timill/RealTime_Models/results_hindcasts/TP4a0.12/ice_only/'+wy+'_GOOD/'+wy+'_'+yd+'/binaries/' outdir = '/work/timill/RealTime_Models/results_hindcasts/Figures/' osdir = '/work/shared/nersc/msc/OSI-SAF/' + wy + '_nh_polstere/' afiles = ['' + dres + 'TP4DAILY_2015_347_2015_351.a'] #,\ # 'TP4DAILY_2016_010_2016_011.a',\ # 'TP4DAILY_2016_010_2016_011.a',\ # 'TP4DAILY_2016_010_2016_011.a' ] for afil in afiles: vo = mr.make_plot_options('hice', ice_mask=True) vo2 = mr.make_plot_options('fice', ice_mask=True) # fice vs OSI-SAF print "afil: ", afil hi = mr.HYCOM_binary_info(afil) dtm = hi.datetime cdate = dtm.strftime('%Y%m%d') figname = 'comp_OSISAF_' + hycomreg + '_' + cdate + '.png' hi.compare_ice_edge_obs(figname=figname, show='False', HYCOMreg=hycomreg) # only OSI-SAF fice osfil = '' + osdir + 'ice_conc_nh_polstere-100_multi_' + cdate + '1200.nc' print "osfil: ", osfil nci = mr.nc_getinfo(osfil) figname = 'OSISAF_' + hycomreg + '_' + cdate + '.png' #nci.plot_var(vo,show=showfigs,figname=figname) nci.make_png(vo2, clim=[0, 1], show='False', HYCOMreg=hycomreg)