Extract a subarray, keeping projectionΒΆ
[1]:
%matplotlib inline
# for figures in notebook
# import & initialize epygram
import epygram
epygram.init_env()
import os
INPUTS_DIR = os.path.join('..', 'inputs')
# [2025/01/16-17:42:44][epygram.formats][<module>:0072][INFO]: Format: HDF5SAF is deactivated at runtime (Error: No module named 'h5py'). Please deactivate from config.implemented_formats or fix error.
[2]:
# open resource in read mode
r = epygram.open(os.path.join(INPUTS_DIR, 'ICMSHAROM+0022'), 'r')
[3]:
f = r.readfield('SURFTEMPERATURE')
print(type(f.geometry))
print(f.geometry.dimensions)
z = f.extract_subarray(10, 45, 25, 105)
print(type(z.geometry))
print(z.geometry.dimensions)
<class 'epygram.geometries.ProjectedGeometry.ProjectedGeometry'>
{'X': 250, 'Y': 250, 'X_CIzone': np.int64(240), 'Y_CIzone': np.int64(240), 'X_Iwidth': np.int64(16), 'Y_Iwidth': np.int64(16), 'X_Czone': np.int64(208), 'Y_Czone': np.int64(208), 'X_CIoffset': np.int64(0), 'Y_CIoffset': np.int64(0)}
<class 'epygram.geometries.ProjectedGeometry.ProjectedGeometry'>
{'X': 36, 'Y': 81}
[ ]: