Example #1
0
plotlistfile = is_valid_path(args.plotlistfile)
inputdir     = is_valid_path(args.inputdir,True)
outputdir    = is_valid_path(args.outputdir,True)
file_pattern = args.pattern



try:
    c_lon, c_lat=coastline.get()
    # Elimination of some parts of the coastline,
    # in order to leave more space for text, if needed
    ii = (c_lat > 40.0) & (c_lon < 0.0) # atlantic coast
    jj = (c_lat > 42.0) & (c_lon > 26 ) # black sea
    c_lon[ii | jj] = np.NaN
    c_lat[ii | jj] = np.NaN
    ii = (c_lon < -6) | (c_lon > 36 )# out of box
    c_lon[ii] = np.NaN
    c_lat[ii] = np.NaN

except:
    c_lon=None
    c_lat=None


file_list = glob(inputdir + "/" + file_pattern)
mb = MapBuilder(plotlistfile, file_list, maskfile, outputdir)
#mb.plot_maps_data(coastline_lon=c_lon, coastline_lat=c_lat)
background=mb.read_background(args.background)
mb.plot_maps_data(coastline_lon=c_lon, coastline_lat=c_lat,background_img=background, maptype=1)
#mb.plot_maps_data(coastline_lon=c_lon, coastline_lat=c_lat,maptype=2)
Example #2
0
File: sat.py Project: inogs/bit.sea
sat_archive="/gss/gss_work/DRES_OGS_BiGe/Observations/TIME_RAW_DATA/ONLINE/SAT/MODIS/DAILY/CHECKED/"
DAILY_SAT_LIST=TS.get_daily_sat(forecasts_sublist,sat_archive)

# float aggregator already done by others
day=0
surf_layer=Layer(0,10)
for time,archived_file,satfile in DAILY_SAT_LIST:
    avefile=INPUTDIR + os.path.basename(archived_file)[:-3]
    day=day+1
    outfile=OUTDIR + "misfit+%dh.nc" % (day*24)
    print avefile
    continue
    Sat16   = Sat.convertinV4format( Sat.readfromfile(satfile) )
    De      = DataExtractor(TheMask,filename=avefile, varname='P_i')
    Model   = MapBuilder.get_layer_average(De, surf_layer)

    Misfit = Sat16-Model

    cloudsLand = (np.isnan(Sat16)) #| (Sat16 > 1.e19) | (Sat16<0)
    modelLand  = np.isnan(Model) #lands are nan
    nodata     = cloudsLand | modelLand
    selection  = ~nodata # & TheMask.mask_at_level(200.0)
    Misfit[nodata] = np.NaN
    
    netcdf3.write_2d_file(Misfit, 'chl_misfit', outfile, TheMask)
    
    
    

Example #3
0
indexes,weights = TL.select(req)

VARCONV=CONVERSION_DICT[var]
# setting up filelist for requested period -----------------
filelist=[]
for k in indexes:
    t = TL.Timelist[k]
    filename = INPUTDIR + "ave." + t.strftime("%Y%m%d-%H:%M:%S") + ".nc"
    print filename
    filelist.append(filename)
# ----------------------------------------------------------
M3d     = TimeAverager3D(filelist, weights, var, TheMask)
for il,layer in enumerate(LAYERLIST):
    De      = DataExtractor(TheMask,rawdata=M3d)
    if args.optype=='integral':
        integrated = MapBuilder.get_layer_integral(De, layer)
    else:
        integrated = MapBuilder.get_layer_average(De, layer)  
    integrated=integrated * VARCONV

#        mask200=TheMask.mask_at_level(200)
    mask200=TheMask.mask_at_level(LIMIT_PER_MASK[il])
#        clim = [M3d[TheMask.mask].min(), M3d[TheMask.mask].max()]
    clim=CLIM_DICT[var]
    integrated200=integrated*mask200 # taglio il costiero
    integrated200[integrated200==0]=np.nan # sostituisco gli 0 con i NAN


    #pl.set_cmap('gray_r') #changes the colormap
    fig,ax     = mapplot({'varname':var, 'clim':clim, 'layer':layer, 'data':integrated200, 'date':''},fig=None,ax=None,mask=TheMask,coastline_lon=clon,coastline_lat=clat)
    ax.set_xlim([-5,36])