Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The reader "viirs_l1b" cannot read the VIIRS L1B data #1489

Closed
anikfal opened this issue Dec 21, 2020 · 5 comments
Closed

The reader "viirs_l1b" cannot read the VIIRS L1B data #1489

anikfal opened this issue Dec 21, 2020 · 5 comments

Comments

@anikfal
Copy link

anikfal commented Dec 21, 2020

Code:

from glob import glob
from satpy.scene import Scene
myfile = glob("VNP02DNB_NRT.A2020326.0912.001.nc")
scn = Scene(reader="viirs_l1b", filenames=myfile)

Error message:

/home/anikfal/miniconda3/lib/python3.8/site-packages/satpy/resample.py:150: UserWarning: Gradient search resampler not available, upgrade Pyresample.
warnings.warn('Gradient search resampler not available, upgrade Pyresample.')
No filenames found for reader: viirs_l1b
Don't know how to open the following files: {'VNP02DNB_NRT.A2020326.0912.001.nc'}
Traceback (most recent call last):
File "1viirs.py", line 9, in
scn = Scene(reader="viirs_l1b", filenames=myfile)
File "/home/anikfal/miniconda3/lib/python3.8/site-packages/satpy/scene.py", line 151, in init
self._readers = self._create_reader_instances(filenames=filenames,
File "/home/anikfal/miniconda3/lib/python3.8/site-packages/satpy/scene.py", line 200, in _create_reader_instances
return load_readers(filenames=filenames,
File "/home/anikfal/miniconda3/lib/python3.8/site-packages/satpy/readers/init.py", line 504, in load_readers
raise ValueError("No supported files found")
ValueError: No supported files found

Environment Info:

  • OS: Fedora-33
  • Satpy Version: 0.23.0
from satpy.config import check_satpy
check_satpy()

...
vii_l1b_nc: ok
vii_l2_nc: ok
viirs_compact: ok
viirs_edr_active_fires: ok
viirs_edr_flood: cannot find module 'satpy.readers.viirs_edr_flood' (No module named 'pyhdf')
viirs_l1b: ok
viirs_sdr: ok
virr_l1b: ok
...

@djhoese
Copy link
Member

djhoese commented Dec 21, 2020

This was updated by @simonrp84 in #1420 and was released in Satpy 0.24. Please update your version of Satpy. Closing this since this should be fixed. Feel free to comment here if you still have issues after upgrading and we can reopen it.

@djhoese djhoese closed this as completed Dec 21, 2020
@anikfal
Copy link
Author

anikfal commented Dec 23, 2020

The previous problem has been solved by updating to version 0.24. But now the code asks for the coordinates which are missing.
The output of print(scn.available_dataset_names()) is ['DNB']

code:

from satpy.scene import Scene
from glob import glob
myfile = glob("VNP02DNB_NRT.A2020326.0912.001.nc")
scn = Scene(reader="viirs_l1b", filenames=myfile)
scn.load(['DNB'])

Error message:

Required file type 'vgeod' not found or loaded for 'dnb_lon'
Required file type 'vgeod' not found or loaded for 'dnb_lat'
Failed to load coordinates for 'DataID(name='DNB', wavelength=WavelengthRange(min=0.5, central=0.7, max=0.9, unit='µm'), resolution=743, calibration=<calibration.radiance>, modifiers=())'

My aim is to convert the VIIRS data to GeoTIFF.

@djhoese
Copy link
Member

djhoese commented Dec 23, 2020

These messages are warnings, not necessarily errors. Satpy will always try to load the geolocation information for the data it is loading and it can't do that without the geolocation files in the case of VIIRS data.

For saving to geotiff: you won't be able to do that without resampling as VIIRS data is not pre-gridded (it is a swath of pixels and non-uniform distances/sizes). Resampling will also require the geolocation files as you can't resample without knowing where the pixels are.

@anikfal
Copy link
Author

anikfal commented Dec 27, 2020

The geolocation file (file2) is available, and the coordinates i_lon and i_lat can be loaded from it. How can we assign them to the main data ('I05') from file1? So we can resample the data.
I could not find much information about the coordinate assignment in the documentation and examples.

Code:

from satpy.scene import Scene
from glob import glob
file1 = glob("VNP02IMG_NRT.A2020351.0154.001.nc")
file2 = glob("VNP03IMG_NRT.A2020354.0012.001.nc")
scn_main = Scene(reader="viirs_l1b", filenames=file1)
scn_geoloc = Scene(reader="viirs_l1b", filenames=file2)
scn_geoloc.load(['i_lon'])
scn_geoloc.load(['i_lat'])
main_data.load(['I05'])

@djhoese
Copy link
Member

djhoese commented Dec 28, 2020

You need to pass all the files to a single Scene object:

scn = Scene(reader='viirs_l1b', filenames=[file1, file2])
scn.load(['I05'])
new_scn = scn.resample(some_area)
new_scn.save_datasets(...)

If you personally want to access the lon/lat arrays then the easiest way would be to do:

lons, lats = scn['I05'].attrs['area'].get_lonlats()

But the resampling in Scene.resample already knows how to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants