Beispiel #1
0
from section import Section

# fake file just for now
fname = fname = 'fake/path/to/netcdf'

# set the timestep of intereste
nstep = np.arange(0, 2, 1)
# variable to plot
var = 'salt'
# instantiate the Section class, given the i,j-indexes
can_clim = Section(fname, 19, 72)
# load data for the given transect (in sigma layers)
can_clim.load_section(nstep, var, mean=True)
# import other variables, as lon,depth,sigma,h1
can_clim.load_auxiliar_data()

# create new grid to interpolate
can_clim.set_newgrid(1000, 80, 80, 150000)
# and finally, interpolate from sigma to z
can_clim.interp_sig2z()

# plot section
can_clim.plot()
# save
can_clim.savefig(os.path.join(outputdir, 'temp_transect', 'clim_cananeia.png'))
Beispiel #2
0
# rectangular section
width = 2.5  # m
height = 0.5  # m
t_spar = 0.05  # m
t_skin = 0.03  # m

Nx = 100
Nz = 20

x = np.linspace(0, width, Nx)
z = np.linspace(0, height, Nz)

lines = [
    ThickLine(zip(x, np.zeros(Nx)), t_skin),
    ThickLine(zip(width * np.ones(Nz), z), t_spar),
    ThickLine(zip(x[::-1], height * np.ones(Nx)), t_skin),
    ThickLine(zip(np.zeros(Nz), z[::-1]), t_spar)
]

rectangular_section = Section(lines)

if __name__ == "__main__":
    # draw section
    fig = rectangular_section.plot()
    ax = plt.gca()
    ax.set_xlim((-0.5, 3))
    ax.set_ylim((-0.25, 1.5))
    ann = ax.annotate(r'$I_1 = x$', xy=(1.5, 1), annotation_clip=False)
    plt.show()