Skip to content

transform xy to latlon from geostationary projection #2778

Answered by dopplershift
fedecutraro asked this question in Q&A
Discussion options

You must be logged in to vote

The problem here is that the data are encoded with x/y coordinates in radians, but the underlying projection code from PROJ expects values in meters. This can be fixed by multiplying the x/y coordinates by ds['goes_imager_projection'].attrs['perspective_point_height']. MetPy will also do this for you if you call our parse_cf() method (this is NOT done when manually assigning the crs as you do above). So things should be fixed if you adjust your original code to:

import xarray as xr
import metpy
ds = xr.open_dataset('OR_GLM-L2-GLMM1-M3_G16_s20222770457400_e20222770502400_c20223091710250.nc')
ds_crs = ds.metpy.parse_cf()
ds_latlon = ds_crs.metpy.assign_latitude_longitude()

Using that I can …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fedecutraro
Comment options

Answer selected by dopplershift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Area: IO Pertains to reading data Area: Projections Pertains to projecting coordinates between coordinate systems Area: Xarray Pertains to xarray integration
2 participants