Recompute u/v from psi/khi (Arpege)

[1]:
# for figures in notebook
%matplotlib inline

# import & initialize epygram
import epygram
epygram.init_env()
# [2025/06/12-17:35:08][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.
# [2025/06/12-17:35:08][falfilfa4py][init_env:0089][WARNING]: ECCODES_DEFINITION_PATH env var is defined: may result in unexpected issues if not consistent with linked eccodes library
[2]:
import os
INPUTS_DIR = os.path.join('..', 'inputs')
# open resource in read mode
r = epygram.open(os.path.join(INPUTS_DIR, 'analysis.full-arpege.tl149-c24.fa'), 'r')
[3]:
psi = r.readfield('S050FONC.COURANT')
khi = r.readfield('S050POT.VITESSE')
# re-compute u/v from psi/khi
uv = epygram.fields.psikhi2uv(psi, khi)

ecTrans at version: 1.6.0
commit: 2c4c818d79effe56d30bb2896866aba590a5fad8

 Setup spectral transform
 End Setup spectral transform
[4]:
fig, ax = uv.cartoplot(subsampling=5, vector_plot_method='quiver',
                       components_are_projected_on='grid')
../../_images/gallery_C-data_06.wind_transformations_psikhi_4_0.png

Be careful to projections of wind components !

[5]:
# wrong projection:
fig, ax = uv.cartoplot(subsampling=5, vector_plot_method='quiver',
                       components_are_projected_on='lonlat')
../../_images/gallery_C-data_06.wind_transformations_psikhi_6_0.png

and stretched grids !

[6]:
# map factor due to stretching:
fig, ax = uv.cartoplot(subsampling=5, vector_plot_method='quiver',
                       components_are_projected_on='grid',
                       map_factor_correction=False)
# [2025/06/12-17:35:10][epygram._plugins.with_cartopy.H2DVectorField][_cartoplot_set_figure_and_module:0048][WARNING]: check carefully *map_factor_correction* w.r.t. dilatation_coef
# [2025/06/12-17:35:10][epygram.geometries.GaussGeometry][reproject_wind_on_lonlat:0704][WARNING]: check carefully *map_factor_correction* w.r.t. dilatation_coef
../../_images/gallery_C-data_06.wind_transformations_psikhi_8_1.png
[ ]: