示例#1
0
for opt, arg in opts:
    if opt == '--infile':
        infile = arg
    if opt == '--outdir':
        outdir = arg
    if opt == '--plotting':
        from distutils.util import strtobool
        plotting = strtobool(arg)
        # if arg not in ['True','False']:
        #    raise ValueError('Use --plotting=True or --plotting=False only')
        #    plotting = (arg=='True')

if infile is None:
    raise ValueError('specify infile with --infile="..."')

hi = mr.HYCOM_binary_info(infile)
if not os.path.exists(outdir):
    os.mkdir(outdir)
# ==========================================================================
basename = infile.split('/')[-1]

# ==========================================================================
# plot OSISAF ice_edge on fice:
if 1:
    odir = outdir + '/../../IceEdgeOSISAF'  # in analysis
    if not os.path.exists(odir):
        os.mkdir(odir)
    figname = odir + '/' + basename[:-2] + '_vIceEdgeOSISAF.png'
    hi.compare_ice_edge_obs(obs_type='OSISAF', date_label=1, figname=figname)
# ==========================================================================
示例#2
0
#,\
#         '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)

    # plot hice
    #nc=mr.nc_getinfo(ncall)
    figname = 'TOPAZ_hice_' + hycomreg + '_' + cdate + '.png'
示例#3
0
    # 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'
    print(ncfil)
    fobj = MR.nc_getinfo(ncfil)
    vobj = 'fice'
elif 1:
    # multi-record netcdf
    ddir = FCdir + '/final_output/'
    dts = yday + 'T000000Z'
    ncfil = ddir + '/SWARPiceonly_forecast_start' + dts + '.nc'
    print(ncfil)
    fobj = MR.nc_getinfo(ncfil)
示例#4
0
eraifile='SWH_'+str(year)+'.nc'
ncfil=eraidir+eraifile
nci=mr.nc_getinfo(ncfil)
################################################################

nci_nearestdate = nearestDate(nci.datetimes,pdate)
rec=nci.datetimes.index(nci_nearestdate)
print 'Nearest Date Time: ',nci.datetimes[rec].__str__(),' record: ',rec


# TODO FIND CLOSEST TIME AND GET FILE ?
# TODO LOOP OVER SOME PERIOD AROUND EVENT
# GET TOPAZ DATA 
adir = '/home/nersc/timill/test_lucia/'
afil = 'TP4archv_wav.2015_351_120000.a'
hi    = mr.HYCOM_binary_info(adir+afil)

hidt  = hi.datetime
fice  = hi.get_var('fice').values
hice  = hi.get_var('hice').values
Dmax  = hi.get_var('dfloe').values
swh   = hi.get_var('swh').values
mwp   = hi.get_var('mwp').values
mwd   = hi.get_var('mwd').values
lon,lat  = hi.get_lonlat()
#nx,ny = hi.Nx,hi.Ny
# remap to bmap projection
# hix,hiy = bmap(lon,lat)

# mask for polygon and for larger square
pmask = np.zeros_like(fice)