Extract a zoom from various geometries¶
[1]:
%matplotlib inline
# for figures in notebook
# import & initialize epygram
import epygram
epygram.init_env()
import os
INPUTS_DIR = os.path.join('..', 'inputs')
[2]:
# open resource in read mode
l = epygram.formats.resource(os.path.join(INPUTS_DIR, 'ICMSHAROM+0022'), 'r')
g = epygram.formats.resource(os.path.join(INPUTS_DIR, 'analysis.full-arpege.tl149-c24.fa'), 'r')
llr = epygram.formats.resource(os.path.join(INPUTS_DIR, 'grid.arome-forecast.guyane0025+0000:00.grib'), 'r')
[3]:
# extract lon/lat area from Lon/Lat regular field: keep projection
f = llr.readfield('shortName:2r')
z = f.extract_zoom(dict(lonmin=-55,lonmax=-50,latmin=4,latmax=7))
z.geometry
[3]:
<epygram.geometries.RegLLGeometry.RegLLGeometry at 0x7b8a56959780>
but¶
[4]:
# extract lon/lat area from Lambert projection grid => unstructured
f = l.readfield('SURFTEMPERATURE')
z = f.extract_zoom(dict(lonmin=7,lonmax=8.5,latmin=45,latmax=46))
z.geometry
[4]:
<epygram.geometries.UnstructuredGeometry.UnstructuredGeometry at 0x7b8a57547fa0>
[5]:
# extract lon/lat area from Gauss grid => unstructured
f = g.readfield('SURFTEMPERATURE')
z = f.extract_zoom(dict(lonmin=7,lonmax=8.5,latmin=45,latmax=46))
z.geometry
[5]:
<epygram.geometries.UnstructuredGeometry.UnstructuredGeometry at 0x7b8a5ada05b0>
[ ]: