pytroll / satpy

Python package for earth-observing satellite data processing
http://satpy.readthedocs.org/en/latest/
GNU General Public License v3.0
1.07k stars 295 forks source link

Viirs sdr band plot with divider #1210

Open cherif2019-dev opened 4 years ago

cherif2019-dev commented 4 years ago

Hi, Do you know why when i make a plot for viirs sdr band is displayed with divisions. Thank you Capture

djhoese commented 4 years ago

These look like they are 3 separate orbits/passes of the instrument. Or perhaps you have data from NOAA-20 (JPSS-1) and Suomi-NPP and are providing both to the Scene.

If this doesn't sound like what is happening, could you provide the names of the files you are providing to the Scene and the code you are running?

cherif2019-dev commented 4 years ago

Thank you Djhoese for your reply : Code:

from satpy import Scene
from glob import glob
filenames = glob("/home/20200511/j01/bands/SVI*")
scn = Scene(reader='viirs_sdr', filenames=filenames)
scn.load(['I01'])
scn.save_datasets()

here is the list of files :

GDNBO_j01_d20200511_t2033134_e2034379_b12848_c20200512113750982717_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2034392_e2036019_b12848_c20200512114209930557_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2036031_e2037277_b12848_c20200512114606066053_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2037289_e2038534_b12848_c20200512114948316710_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2038546_e2040192_b12848_c20200512115325883101_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2040204_e2041449_b12848_c20200512115716894059_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2041462_e2043089_b12848_c20200512120054877638_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2043101_e2044346_b12848_c20200512120444720624_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2209562_e2211208_b12849_c20200512120823331777_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2211220_e2212465_b12849_c20200512121202947282_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2212478_e2214123_b12849_c20200512121559083020_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2214135_e2215380_b12849_c20200512122003865936_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2215393_e2217020_b12849_c20200512122416977010_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2217032_e2218278_b12849_c20200512122815298838_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2218290_e2219535_b12849_c20200512123205236094_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2219548_e2221193_b12849_c20200512123549327803_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2352221_e2353466_b12850_c20200512123916308627_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2353479_e2355124_b12850_c20200512124258449595_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2355136_e2356364_b12850_c20200512124647837163_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2356376_e2358021_b12850_c20200512125043634493_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2358033_e2359279_b12850_c20200512125448637163_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200511_t2359291_e0000536_b12850_c20200512125844148233_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200512_t0000549_e0002194_b12850_c20200512130236966166_cspp_dev.h5
6 days ago169 MB
GDNBO_j01_d20200512_t0002206_e0003433_b12850_c20200512130619971461_cspp_dev.h5
6 days ago169 MB
GITCO_j01_d20200511_t2033134_e2034379_b12848_c20200512113751239251_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2034392_e2036019_b12848_c20200512114210193008_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2036031_e2037277_b12848_c20200512114606314545_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2037289_e2038534_b12848_c20200512114948603534_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2038546_e2040192_b12848_c20200512115326154233_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2040204_e2041449_b12848_c20200512115717144028_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2041462_e2043089_b12848_c20200512120055133630_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2043101_e2044346_b12848_c20200512120444989706_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2209562_e2211208_b12849_c20200512120823600345_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2211220_e2212465_b12849_c20200512121203248699_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2212478_e2214123_b12849_c20200512121559337314_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2214135_e2215380_b12849_c20200512122004141026_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2215393_e2217020_b12849_c20200512122417238021_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2217032_e2218278_b12849_c20200512122815567730_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2218290_e2219535_b12849_c20200512123205491402_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2219548_e2221193_b12849_c20200512123549585476_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2352221_e2353466_b12850_c20200512123916591012_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2353479_e2355124_b12850_c20200512124258729462_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2355136_e2356364_b12850_c20200512124648083019_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2356376_e2358021_b12850_c20200512125043903722_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2358033_e2359279_b12850_c20200512125448893798_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200511_t2359291_e0000536_b12850_c20200512125844433427_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200512_t0000549_e0002194_b12850_c20200512130237223619_cspp_dev.h5
6 days ago324 MB
GITCO_j01_d20200512_t0002206_e0003433_b12850_c20200512130620231168_cspp_dev.h5
6 days ago324 MB
GMTCO_j01_d20200511_t2033134_e2034379_b12848_c20200512113752524514_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2034392_e2036019_b12848_c20200512114211425674_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2036031_e2037277_b12848_c20200512114607649811_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2037289_e2038534_b12848_c20200512114950021088_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2038546_e2040192_b12848_c20200512115327479700_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2040204_e2041449_b12848_c20200512115718565831_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2041462_e2043089_b12848_c20200512120056434184_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2043101_e2044346_b12848_c20200512120446355052_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2209562_e2211208_b12849_c20200512120824912362_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2211220_e2212465_b12849_c20200512121204648601_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2212478_e2214123_b12849_c20200512121600498061_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2214135_e2215380_b12849_c20200512122005763991_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2215393_e2217020_b12849_c20200512122418815439_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2217032_e2218278_b12849_c20200512122816943802_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2218290_e2219535_b12849_c20200512123206869818_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2219548_e2221193_b12849_c20200512123550996243_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2352221_e2353466_b12850_c20200512123918056087_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2353479_e2355124_b12850_c20200512124300367243_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2355136_e2356364_b12850_c20200512124649417536_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2356376_e2358021_b12850_c20200512125045361327_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2358033_e2359279_b12850_c20200512125450236466_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200511_t2359291_e0000536_b12850_c20200512125845997119_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200512_t0000549_e0002194_b12850_c20200512130238595493_cspp_dev.h5
6 days ago81.2 MB
GMTCO_j01_d20200512_t0002206_e0003433_b12850_c20200512130621648547_cspp_dev.h5
6 days ago81.2 MB
IVCDB_j01_d20200511_t2033134_e2034379_b12848_c20200512113844246022_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2034392_e2036019_b12848_c20200512114249375037_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2036031_e2037277_b12848_c20200512114646286037_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2037289_e2038534_b12848_c20200512115028225016_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2038546_e2040192_b12848_c20200512115413269580_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2040204_e2041449_b12848_c20200512115800320023_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2041462_e2043089_b12848_c20200512120138735494_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2043101_e2044346_b12848_c20200512120525309829_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2209562_e2211208_b12849_c20200512120902840033_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2211220_e2212465_b12849_c20200512121246704262_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2212478_e2214123_b12849_c20200512121641338365_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2214135_e2215380_b12849_c20200512122057289576_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2215393_e2217020_b12849_c20200512122507119226_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2217032_e2218278_b12849_c20200512122858402140_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2218290_e2219535_b12849_c20200512123249740774_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2219548_e2221193_b12849_c20200512123627125725_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2352221_e2353466_b12850_c20200512124002338750_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2353479_e2355124_b12850_c20200512124345939024_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2355136_e2356364_b12850_c20200512124729921134_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2356376_e2358021_b12850_c20200512125126686071_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2358033_e2359279_b12850_c20200512125537747932_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200511_t2359291_e0000536_b12850_c20200512125927610723_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200512_t0000549_e0002194_b12850_c20200512130319725429_cspp_dev.h5
6 days ago124 MB
IVCDB_j01_d20200512_t0002206_e0003433_b12850_c20200512130659134998_cspp_dev.h5
6 days ago124 MB
SVDNB_j01_d20200511_t2033134_e2034379_b12848_c20200512113844183360_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2034392_e2036019_b12848_c20200512114249307271_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2036031_e2037277_b12848_c20200512114646224345_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2037289_e2038534_b12848_c20200512115028163266_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2038546_e2040192_b12848_c20200512115413167062_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2040204_e2041449_b12848_c20200512115800256482_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2041462_e2043089_b12848_c20200512120138657746_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2043101_e2044346_b12848_c20200512120525245791_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2209562_e2211208_b12849_c20200512120902775995_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2211220_e2212465_b12849_c20200512121246642429_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2212478_e2214123_b12849_c20200512121641265302_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2214135_e2215380_b12849_c20200512122057223403_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2215393_e2217020_b12849_c20200512122507055414_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2217032_e2218278_b12849_c20200512122858337278_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2218290_e2219535_b12849_c20200512123249673002_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2219548_e2221193_b12849_c20200512123627064390_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2352221_e2353466_b12850_c20200512124002274294_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2353479_e2355124_b12850_c20200512124345873979_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2355136_e2356364_b12850_c20200512124729854041_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2356376_e2358021_b12850_c20200512125126620980_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2358033_e2359279_b12850_c20200512125537682582_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200511_t2359291_e0000536_b12850_c20200512125927541116_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200512_t0000549_e0002194_b12850_c20200512130319660407_cspp_dev.h5
6 days ago15.7 MB
SVDNB_j01_d20200512_t0002206_e0003433_b12850_c20200512130659060279_cspp_dev.h5
6 days ago15.7 MB
SVI01_j01_d20200511_t2033134_e2034379_b12848_c20200512113844469631_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2034392_e2036019_b12848_c20200512114249571642_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2036031_e2037277_b12848_c20200512114646483264_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2037289_e2038534_b12848_c20200512115028421698_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2038546_e2040192_b12848_c20200512115413478255_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2040204_e2041449_b12848_c20200512115800530702_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2041462_e2043089_b12848_c20200512120138942707_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2043101_e2044346_b12848_c20200512120525526038_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2209562_e2211208_b12849_c20200512120903043010_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2211220_e2212465_b12849_c20200512121246912405_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2212478_e2214123_b12849_c20200512121641540401_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2214135_e2215380_b12849_c20200512122057543217_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2215393_e2217020_b12849_c20200512122507323557_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2217032_e2218278_b12849_c20200512122858606228_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2218290_e2219535_b12849_c20200512123249942078_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2219548_e2221193_b12849_c20200512123627319154_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2352221_e2353466_b12850_c20200512124002557825_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2353479_e2355124_b12850_c20200512124346136021_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2355136_e2356364_b12850_c20200512124730122953_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2356376_e2358021_b12850_c20200512125126886065_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2358033_e2359279_b12850_c20200512125537945649_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200511_t2359291_e0000536_b12850_c20200512125927839201_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200512_t0000549_e0002194_b12850_c20200512130319930471_cspp_dev.h5
6 days ago49.2 MB
SVI01_j01_d20200512_t0002206_e0003433_b12850_c20200512130659337713_cspp_dev.h5
6 days ago49.2 MB
djhoese commented 4 years ago

If you look at the times in the files for SVI which are the data files you are loading (you will want to also load the GITCO files for the I-band navigation data in the future), you see a jump in times:

SVI01_j01_d20200511_t2033134_e2034379_b12848_c20200512113844469631_cspp_dev.h5
...
SVI01_j01_d20200511_t2043101_e2044346_b12848_c20200512120525526038_cspp_dev.h5
SVI01_j01_d20200511_t2209562_e2211208_b12849_c20200512120903043010_cspp_dev.h5
...
SVI01_j01_d20200511_t2219548_e2221193_b12849_c20200512123627319154_cspp_dev.h5
SVI01_j01_d20200511_t2352221_e2353466_b12850_c20200512124002557825_cspp_dev.h5
...
SVI01_j01_d20200512_t0002206_e0003433_b12850_c20200512130659337713_cspp_dev.h5

I've put ... for the series of files that don't matter right now. See how the tHHMMSSu times go from t2043... to t2209? Then later t2219 to t2352? That's about a 1.5 hour jump. These are three separate passes of the satellite. The three sections of your image are expected. I would recommend only operating on one orbit at a time or looking at Satpy's MultiScene interface if you really want to work on multiple orbits at a time (just start with one Scene for now).

cherif2019-dev commented 4 years ago

Thank you so much Djhoese,

I added these lines of code to work with multiscene but I encountered these errors code : from satpy import MultiScene mscn = MultiScene.from_files(filenames, reader='viirs_sdr') from pyresample import create_area_def my_area = create_area_def('my_area', {'proj': 'latlong'}, width=3000, height=3000, units='degrees') new_mscn = mscn.resample(my_area) blended_scn = new_mscn.blend() Errors : Required file type 'generic_file' not found or loaded for 'i_longitude' Required file type 'generic_file' not found or loaded for 'i_longitude' Required file type 'generic_file' not found or loaded for 'i_longitude' IndexError Traceback (most recent call last)

in ----> 1 blended_scn = new_mscn.blend() ~/.conda/envs/satpy/lib/python3.7/site-packages/satpy/multiscene.py in blend(self, blend_function) 261 """ 262 new_scn = Scene() --> 263 common_datasets = self.shared_dataset_ids 264 for ds_id in common_datasets: 265 datasets = [scn[ds_id] for scn in self.scenes if ds_id in scn] ~/.conda/envs/satpy/lib/python3.7/site-packages/satpy/multiscene.py in shared_dataset_ids(self) 195 def shared_dataset_ids(self): 196 """Dataset IDs shared by all children.""" --> 197 shared_ids = set(self.scenes[0].keys()) 198 for scene in self.scenes[1:]: 199 shared_ids &= set(scene.keys()) IndexError: list index out of range
djhoese commented 4 years ago

Yeah that's why I thought it would be better to start with a single Scene operating on a single orbit of data before diving into MultiScenes. What is your end goal for what you are doing? What are you trying to produce? I can provide better advice if I know this.

That said, the main issue with your code is that you need to do mscn.load(['I01']) before calling resample. This is the call that actually loads the data in to the scene objects. Without it you aren't actually operating on any data.

cherif2019-dev commented 4 years ago

Hi Djhoese, I encountered another problem when I want to have the coordinates in degree for viirs sdr band I01 it shows me a bad result code : from pyresample import create_area_def my_area = create_area_def('my_area', {'proj': 'latlong'}, width=1000, height=1000, units='degrees') Capture

new_scn = scn.resample(my_area)

djhoese commented 4 years ago

That's actually expected for what you've provided. You have a swath that is going over the north pole and you are plotting it on a lat/lon projection. That projection goes from -180 degrees to 180 degrees longitude on the X-axis and -90 degrees to 90 degrees latitude on the Y-axis. Your data hits the north pole (90 degrees latitude) where it spans across the entire X dimension (the north pole has all longitudes -180/180 intersecting it). So, what you have is expected. If you could tell me what you want your end result to be I can help more.

Note: the axes in your plot are number of pixels of the image, not coordinates (1000 pixels x 1000 pixels).

cherif2019-dev commented 4 years ago

Thank you,I'm doing research in Antarctica do you have any idea on the best projection i should choose

pnuu commented 4 years ago

The most suitable projection still depends on the actual use. Do you need equal area? Do you need it to be "nice to look at", does the projection to keep the shapes close to real (conformal projections), and so on.

I'd start with EPSG:3031, EPSG:3409 (EASE grid South), or something similar, again depending on the use and possible refence data you have.

djhoese commented 4 years ago

Agree with @pnuu that it depends on your desired use case. To clarify the EPSG stuff: EPSG codes are a pre-defined set of projections (coordinate systems) that you can use instead of specifying all the parameters you normally would with PROJ (ex. +proj=lcc +lon_0=-95 ...). Instead of passing that PROJ information as a dict like you were before, you should be able to pass the string "EPSG:3031" to create_area_def and have it behave in a similar manner.

cherif2019-dev commented 4 years ago

Thanks @pnuu, @djhoese , do you know how i can define this projection with create_area_def projection = '+proj=eqc +datum=WGS84 +ellps=WGS84 +lat_ts=%s +lat_0=%s +lon_0=%s +units=m +a=6371228.0' %(lats_median, lats_median, lons_median)

djhoese commented 4 years ago

Where did you get that projection string from? Why are you changing the values and using string formatting? Again, if there is something specific you are trying to do here please tell us because right now we are just guessing what would be best for you. If you know what would be best then let us know.

As for how you would use the EPSG code with pyproj, that's what I was trying to say before:

my_area = create_area_def('my_area', 'EPSG:3031', width=1000, height=1000)

Satpy should figure out the rest...I think.

cherif2019-dev commented 4 years ago

HI, how I can know the exact location of the band to choose the right projection

mraspaud commented 4 years ago

The viirs data comes with a metadata about it's bounding box, so you could use that. Otherwise, satpy has an oblique mercator projection that adapts to the content, try resampling in satpy to omerc_bb.

djhoese commented 4 years ago

By that he means new_scn = scn.resample('omerc_bb').

cherif2019-dev commented 4 years ago

Great, Thanks @mraspaud , @djhoese, it's better now I encountered another problem when I want to display the gridline labels it displayed this error Code : crs = new_scn['I01'].attrs['area'].to_cartopy_crs() plt.figure() ax = plt.axes(projection=crs)

my_data = new_scn['I01'] my_data.plot.imshow(transform=crs) ax.coastlines() ax.gridlines(draw_labels=True, dms=True, x_inline=False, y_inline=False)

Error :

in 11 my_data.plot.imshow(transform=crs) 12 ax.coastlines() ---> 13 ax.gridlines(draw_labels=True, dms=True, x_inline=False, y_inline=False) ~/.conda/envs/satpy/lib/python3.7/site-packages/cartopy/mpl/geoaxes.py in gridlines(self, crs, draw_labels, xlocs, ylocs, **kwargs) 1222 gl = Gridliner( 1223 self, crs=crs, draw_labels=draw_labels, xlocator=xlocs, -> 1224 ylocator=ylocs, collection_kwargs=kwargs) 1225 self._gridliners.append(gl) 1226 return gl ~/.conda/envs/satpy/lib/python3.7/site-packages/cartopy/mpl/gridliner.py in __init__(self, axes, crs, draw_labels, xlocator, ylocator, collection_kwargs) 183 # public attributes are changed after instantiation. 184 if draw_labels: --> 185 self._assert_can_draw_ticks() 186 187 #: The number of interpolation points which are used to draw the ~/.conda/envs/satpy/lib/python3.7/site-packages/cartopy/mpl/gridliner.py in _assert_can_draw_ticks(self) 397 '{prj.__class__.__name__} plot. Only PlateCarree' 398 ' and Mercator plots are currently ' --> 399 'supported.'.format(prj=self.axes.projection)) 400 return True 401 TypeError: Cannot label gridlines on a _PROJ4Projection plot. Only PlateCarree and Mercator plots are currently supported.
djhoese commented 4 years ago

@cherif2019-dev To add to all of this, I again ask what are you trying to do? There are two possible ways to approach this problem:

  1. You want the data to look the best it possibly can (least amount of distortion) regardless of the orbit. This requires changing the projection and therefore your AreaDefinition for every pass. This has two downsides, it takes extra processing to determine the best projection and you can't compare data between orbits because the size, location, and "look" of your images change for every satellite pass.
  2. You pick a single static projection that you use for every orbit; one AreaDefinition. This has the benefits of making it easy to compare and analyze your data because the output images are always the same size, location, and look. Since the AreaDefinition is static we don't have to waste time figuring out what the best projection and location is. The downside to this approach is that some satellite passes may appear "sub-optimal" if they are in the more distorted portion of the projection/area. However, if a good projection is chosen then this is less likely or the effect is going to be minimal/negligible.
djhoese commented 4 years ago

Your last error is from cartopy. This is a known limitation of cartopy as the error says. However, in the most recent version of cartopy (released last week I think) they made it so this is possible. At least that's what I've read.