예제 #1
0
def figure_generator(p):
    ''' Generates a figure to plot the matchups related to a bioFloat cycle
    There are 6 axes: map, temperature, salinity, chl, oxygen and nitrate

    Arguments:
    * p * is a profile object

    Returns
    fig, axes (array of axes handlers)
    '''
    fig, axs = pl.subplots(2,3, facecolor='w', edgecolor='k')
    hsize=10
    vsize=12
    fig.set_size_inches(hsize,vsize)
    #figtitle = " date="+p.time.strftime('%Y/%m/%d')+" float="+p.name()
    #fig.set_title(figtitle)
    fig.subplots_adjust(hspace = 0.15, wspace=0.3)
    axs = axs.ravel()

    ax = axs[0]
    c_lon, c_lat=coastline.get()
    ax.plot(c_lon,c_lat, color='#000000',linewidth=0.5)
    ax.plot(p.lon,p.lat,'ro')
    ax.set_xticks(np.arange(-6,36,2))
    ax.set_yticks(np.arange(0,100,2))
    ax.set_xlabel("lon")
    ax.set_ylabel("lat")
    ax.set_title(p.time.strftime('%Y/%m/%d'))
    extent=10 #degrees
    ax.set_xlim([p.lon -extent/2, p.lon+extent/2])
    ax.set_ylim([p.lat -extent/2, p.lat+extent/2])
    bbox=ax.get_position()

    deltax, _ =bbox.size
    new_deltay = deltax* hsize/vsize
    bottom = bbox.ymax - new_deltay
    ax.set_position([bbox.xmin, bottom, deltax, new_deltay])

    floatlabel = 'Float \n'+ p.name() +" - "+str(p._my_float.cycle)
    f_patch = mpatches.Patch(color='green', label='Model_forecast')
    b_patch = mpatches.Patch(color='red'  , label='Model_analysis')
    g_patch = mpatches.Patch(color='blue', label=floatlabel)
    ax.legend(handles=[f_patch, b_patch,g_patch], bbox_to_anchor=(0, -0.5), loc=2)

    for ax in axs[1:]:
        ax.set_ylim(0,400)
        ax.locator_params(axis='x',nbins=4)
        ax.yaxis.grid()

    for ax in [axs[2], axs[4], axs[5]]:
        ax.set_yticklabels([])

    return fig,axs
예제 #2
0
    	hsize=10
    	vsize=12
    	fig.set_size_inches(hsize,vsize)
    	fig.subplots_adjust(hspace = 0.15, wspace=0.3)
    	axs = axs.ravel()



###########
# SELECT THE VARIABLE:
	for ipp, ppp in enumerate(Float) : 

#########
# TRAJECTORY FIGURE:
    	    ax = axs[0]
    	    c_lon, c_lat=coastline.get()
    	    ax.plot(c_lon,c_lat, color='#000000',linewidth=0.5)
    	    ax.plot(ppp.lon,ppp.lat,'ro')
    	    ax.set_xticks(np.arange(-6,36,2))
    	    ax.set_yticks(np.arange(0,100,2))
     	    ax.set_xlabel("lon")
    	    ax.set_ylabel("lat")

	    extent=10 #degrees
	    ax.set_xlim([ppp.lon -extent/2, ppp.lon+extent/2])
	    ax.set_ylim([ppp.lat -extent/2, ppp.lat+extent/2])
	    bbox=ax.get_position()

	    deltax, _ =bbox.size
	    new_deltay = deltax* hsize/vsize
	    bottom = bbox.ymax - new_deltay
예제 #3
0
import numpy as np
import os

from commons.time_interval import TimeInterval
from commons.Timelist import TimeList
from commons.mask import Mask
from commons.layer import Layer

from layer_integral.mapplot import mapplot
import commons.timerequestors as requestors
import Sat.SatManager as Sat
import pylab as pl
from layer_integral import coastline

clon, clat = coastline.get()
maskfile = os.getenv("MASKFILE")
TheMask = Mask(maskfile)
_, jpj, jpi = TheMask.shape

Timestart = os.getenv("START_DATE")
Time__end = os.getenv("END_DATE")


INPUTDIR = args.inputdir
OUTPUTDIR = args.outdir


TI = TimeInterval(Timestart, Time__end, "%Y%m%d")
TL = TimeList.fromfilenames(TI, INPUTDIR, "*.nc", prefix="", dateformat="%Y%m%d")