transform xy to latlon from geostationary projection #2778
-
I processed data from GLM sensor with the glmtools library and got the next netCDF file OR_GLM-L2-GLMM1-M3_G16_s20222770457400_e20222770502400_c20223091710250.zip I tried to convert the x,y coordinates to latitude and longitude with the next code
but the latitudes and longitudes I got are very next to the subsatellite point and not that I would expect. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
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 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 get something somewhat reasonable (not knowing what's in the file exactly): |
Beta Was this translation helpful? Give feedback.
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:Using that I can …