pytroll / satpy

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

Can't open NOAA-20 VIIRS NRT NetCDF4 (.nc) file #2435

Open sgcderek opened 1 year ago

sgcderek commented 1 year ago

Describe the bug Trying to open an nc file downloaded from NOAA containing VIIRS NRT data gives ValueError: No supported files found

To Reproduce

import os
from satpy.scene import Scene

reader = "viirs_l1b"
scn = Scene(reader=reader, filenames=["VJ101_NRT.A2023092.1200.021.2023092130010.nc"])

Expected behavior The scene is loaded without errors.

Actual results

derek@desktop:~/satpy$ python3 viirs-combiner.py3
/usr/lib/python3/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
/home/derek/.local/lib/python3.10/site-packages/satpy/_config.py:129: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.
  for entry_point in cached_entry_points().get(name, []):
[DEBUG: 2023-04-02 17:31:00 : satpy.readers.yaml_reader] Reading ('/home/derek/.local/lib/python3.10/site-packages/satpy/etc/readers/viirs_l1b.yaml',)
[WARNING: 2023-04-02 17:31:00 : satpy.readers.yaml_reader] No filenames found for reader: viirs_l1b
[WARNING: 2023-04-02 17:31:00 : satpy.readers] Don't know how to open the following files: {'VJ101_NRT.A2023092.1200.021.2023092130010.nc'}
Traceback (most recent call last):
  File "/home/derek/satpy/viirs-combiner.py3", line 7, in <module>
    scn = Scene(reader=reader, filenames=["VJ101_NRT.A2023092.1200.021.2023092130010.nc"])
  File "/home/derek/.local/lib/python3.10/site-packages/satpy/scene.py", line 133, in __init__
    self._readers = self._create_reader_instances(filenames=filenames,
  File "/home/derek/.local/lib/python3.10/site-packages/satpy/scene.py", line 154, in _create_reader_instances
    return load_readers(filenames=filenames,
  File "/home/derek/.local/lib/python3.10/site-packages/satpy/readers/__init__.py", line 584, in load_readers
    _check_reader_instances(reader_instances)
  File "/home/derek/.local/lib/python3.10/site-packages/satpy/readers/__init__.py", line 623, in _check_reader_instances
    raise ValueError("No supported files found")
ValueError: No supported files found

Environment Info:

Additional context Tried with all three above mentioned readers. The nc file was obtained from NOAA Earthdata, full link; https://nrt3.modaps.eosdis.nasa.gov/api/v2/content/archives/allData/5201/VJ101_NRT/2023/092/VJ101_NRT.A2023092.1200.021.2023092130010.nc

djhoese commented 1 year ago

Any idea if these are normal L1B files? Here is a link to the configuration file that has all the file patterns supported by the VIIRS L1B reader:

https://github.com/pytroll/satpy/blob/bebcc5b6b3d8ec00e16167e4e82f525ba835c36f/satpy/etc/readers/viirs_l1b.yaml#L35-L77

The main difference seems to be the 01 part of the prefix. V is expected, J1 is expected, the 01 after those is not. We expect something like 02IMG for example. I don't usually use Earthdata. Could you point me to the product catalog that describes this product?

djhoese commented 1 year ago

Ah those are likely the raw radiances:

https://www.earthdata.nasa.gov/learn/find-data/near-real-time/viirs

Our reader only supports the calibrated L1B products.

sgcderek commented 1 year ago

Indeed it appears that I have been mistakenly downloading L1A files instead L1B, thank you. However I am running into another issue, with a correct file, simply trying to save a single band as a png file;

from satpy.scene import Scene

reader = "viirs_l1b"
scn = Scene(reader=reader, filenames=["VJ102IMG_NRT.A2023092.1200.021.2023092135849.nc"])
scn.load(['M01'])
scn = scn.resample(resampler='native')
scn.save_datasets(filename="__{name}.png")

I get the following errors;

/usr/lib/python3/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
Required file type 'vgeom' not found or loaded for 'm_lon'
Required file type 'vgeom' not found or loaded for 'm_lat'
Required file type 'vl1bm' not found or loaded for 'M01'
The following datasets were not created and may require resampling to be generated: DataID(name='M01', wavelength=WavelengthRange(min=0.402, central=0.412, max=0.422, unit='µm'), resolution=742, calibration=<calibration.reflectance>, modifiers=())
Traceback (most recent call last):
  File "/home/derek/satpy/viirs-combiner.py3", line 6, in <module>
    scn = scn.resample(resampler='native')
  File "/home/derek/.local/lib/python3.10/site-packages/satpy/scene.py", line 958, in resample
    destination = self.finest_area(datasets)
  File "/home/derek/.local/lib/python3.10/site-packages/satpy/scene.py", line 313, in finest_area
    return self._compare_areas(datasets=datasets, compare_func=max)
  File "/home/derek/.local/lib/python3.10/site-packages/satpy/scene.py", line 244, in _compare_areas
    areas = self._gather_all_areas(datasets)
  File "/home/derek/.local/lib/python3.10/site-packages/satpy/scene.py", line 297, in _gather_all_areas
    raise ValueError("No dataset areas available")
ValueError: No dataset areas available

Even though I am using the native resampler

djhoese commented 1 year ago

That paraniko warning is a little odd, but likely not the issue. Try assigning the resampled Scene to a new name instead of reusing "scn"...but also a single band isn't supposed to require resampling. 🤔 I'll have to think about this later when I have more time.

djhoese commented 1 year ago

Oh you only gave it the I band file. You need to provide the M band (MOD) and geolocation for M bands to be able properly resample. Without the geo you should be OK saving to PNG...I think.