Example #1
0
@author: Bernard Legras
"""
import numpy as np
from datetime import datetime, timedelta
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

from ECMWF_N import ECMWF

dat = ECMWF('FULL-EA', datetime(2020, 1, 21, 6), exp='VOZ')
dat._get_var('VO')
dat._get_var('T')

#%% Example of a plot that is contained within the southern west hemisphere

dats = dat.extract(varss=['T', 'VO'], lonRange=(240, 300), latRange=(-80, -30))

dats.show('VO', 49)
dats.show('VO', 49, projec='ortho', xylim=True)

# Same plot with a projection where the shift is -360 everywhere (proj extent, boundaries)
ortho = ccrs.Orthographic(270 - 360, -55)
extent = (240 - 360, 300 - 360, -80, -30)
ax = plt.axes(projection=ortho)
ax.imshow(dats.var['VO'][49, ...],
          transform=ccrs.PlateCarree(),
          extent=extent,
          origin='lower',
          interpolation='nearest',
          cmap='jet')
x1, _ = ortho.transform_point(240 - 360, -30, ccrs.Geodetic())
Example #2
0
from datetime import datetime
#import pickle,gzip
#import matplotlib.pyplot as plt
from os.path import join

from ECMWF_N import ECMWF

date = datetime(2017, 8, 23, 3)
dat = ECMWF('FULL-EA', date, exp='VOZ')

#date = datetime(2020,1,23,6)
#dat = ECMWF('OPZ',date)

#date = datetime(2017,8,10,0)
#dat = ECMWF('STC',date)

#%%
dat._get_T()
dat._get_var('VO')
dat._get_U()
dat._get_V()
dat._mkp()
dat._mkthet()
#%%
print('now call mkpv')
dat._mkpv()

#%%
#dats = dat.interpolPT([350,370,395,430],varList=['PV'],lonRange=(50,120),latRange=(0,50))
dats = dat.extract(varss='All', lonRange=(240, 330), latRange=(-80, -30))