Sample file can download from https://noaa-goes17.s3.amazonaws.com/ABI-L1b-RadF/2021/213/00/OR_ABI-L1b-RadF-M6C13_G17_s20212130000319_e20212130009396_c20212130009445.nc
I am trying to convert a projection to a plate carree.
I loaded netcdf using Satpy.
from satpy import Scene
from glob import glob
goes17 = glob('./samplefile/*')
goes17_scene = Scene(reader="abi_l1b", filenames=goes17)
Then I want resample it to Plate carree using https://satpy.readthedocs.io/en/stable/resample.html#create-custom-area-definition but there is no sample code.
That documentation could definitely be improved (I'm not complaining, I'm one of the authors). For one, it should point to this documentation from pyresample on how to make a custom AreaDefinition:
https://pyresample.readthedocs.io/en/latest/geometry_utils.html
For your case of wanting to resampling to a plate carree (equirectangular) projection, you could try something like this:
from pyresample import create_area_def
area_def = create_area_def("my_area_def", "+proj=eqc +datum=WGS84", resolution=2000)
This will make what is known as a DynamicAreaDefinition
which is an AreaDefinition
that doesn't have all of its parameters defined. For example, there is no extent/bounds to this area. I did define it as having a resolution of 2km per pixel. We can provide this dynamic area definition to Satpy and it will "freeze" it with the geolocation from the ABI data. So your code would then look like this:
from satpy import Scene
from glob import glob
from pyresample import create_area_def
area_def = create_area_def("my_area_def", "+proj=eqc +datum=WGS84", resolution=2000)
goes17 = glob('./samplefile/*')
goes17_scene = Scene(reader="abi_l1b", filenames=goes17)
goes17_scene.load(['C13'])
new_scn = goes17_scene.resample(area_def)
# save to geotiffs
new_scn.save_datasets()
Note that if you know the exact bounds of your area when you call create_area_def
you can create a fully qualified AreaDefinition
and this will perform better when resampling (since Satpy doesn't have to compute the bounds of the dynamic area).