Comments (6)
@adybbroe I'm not sure I completely understand. Could you please provide a the full "ugly" traceback when the KeyError occurs?
from satpy.
I would rather suggest @sjoro to have a look at this again.
from satpy.
i'll try to provide an example this week.
from satpy.
here's an example. i have a native MSG SEVIRI file which does not have IR 9.7 channel available.
- loading VIS 0.6 channel goes smoothly as expected
- trying to load IR 9.7 channel throws the ugly KeyError traceback
- loading VIS 0.8 channel after this succeeds, but prints and repeats the IR 9.7 channel KeyError traceback.
i can provide the native file in question for testing purposes.
hope this helps.
In [11]: scn1 = Scene(
....: sensor="seviri",
....: reader="native_msg",
....: filenames=[path+fname]
....: )
In [12]: scn1.load([0.6])
[DEBUG: 2017-04-21 11:11:10 : native_msg] Calibration time 0:00:00.090550
In [13]: scn1.load([9.7])
[ERROR: 2017-04-21 11:11:14 : satpy.readers.yaml_reader] Could not load dataset
'DatasetID(name='IR_097', wavelength=(9.38, 9.66, 9.94), resolution=3000.403165817,
polarization=None, calibration='brightness_temperature', modifiers=())': 'Channel IR_097 not available
in the file'
Traceback (most recent call last):
File "/tcenas/home/joro/pytroll/satpy/satpy/readers/yaml_reader.py", line 810, in _load_dataset_with_area
ds = self._load_dataset_data(file_handlers, dsid, **slice_kwargs)
File "/tcenas/home/joro/pytroll/satpy/satpy/readers/yaml_reader.py", line 671, in _load_dataset_data
proj = self._load_entire_dataset(dsid, ds_info, file_handlers)
File "/tcenas/home/joro/pytroll/satpy/satpy/readers/yaml_reader.py", line 589, in _load_entire_dataset
projectable = fh.get_dataset(dsid, ds_info)
File "/tcenas/home/joro/pytroll/satpy/satpy/readers/native_msg.py", line 262, in get_dataset
raise KeyError('Channel % s not available in the file' % key.name)
KeyError: 'Channel IR_097 not available in the file'
[WARNING: 2017-04-21 11:11:14 : satpy.scene] The following datasets were not created:
DatasetID(name='IR_097', wavelength=(9.38, 9.66, 9.94), resolution=3000.403165817,
polarization=None, calibration='brightness_temperature', modifiers=())
In [14]: scn1.load([0.8])
[ERROR: 2017-04-21 11:11:18 : satpy.readers.yaml_reader] Could not load dataset 'DatasetID(name='IR_097', wavelength=(9.38, 9.66, 9.94), resolution=3000.403165817, polarization=None, calibration='brightness_temperature', modifiers=())': 'Channel IR_097 not available in the file'
Traceback (most recent call last):
File "/tcenas/home/joro/pytroll/satpy/satpy/readers/yaml_reader.py", line 810, in _load_dataset_with_area
ds = self._load_dataset_data(file_handlers, dsid, **slice_kwargs)
File "/tcenas/home/joro/pytroll/satpy/satpy/readers/yaml_reader.py", line 671, in _load_dataset_data
proj = self._load_entire_dataset(dsid, ds_info, file_handlers)
File "/tcenas/home/joro/pytroll/satpy/satpy/readers/yaml_reader.py", line 589, in _load_entire_dataset
projectable = fh.get_dataset(dsid, ds_info)
File "/tcenas/home/joro/pytroll/satpy/satpy/readers/native_msg.py", line 262, in get_dataset
raise KeyError('Channel % s not available in the file' % key.name)
KeyError: 'Channel IR_097 not available in the file'
[DEBUG: 2017-04-21 11:11:18 : native_msg] Calibration time 0:00:00.091112
[WARNING: 2017-04-21 11:11:18 : satpy.scene] The following datasets were not created:
DatasetID(name='IR_097', wavelength=(9.38, 9.66, 9.94), resolution=3000.403165817,
polarization=None, calibration='brightness_temperature', modifiers=())
In [15]:
from satpy.
If I'm understanding this correctly here is what is happening:
- Load scene with seviri file that does not always have all datasets available
- Ask for a dataset that could exist, but doesn't exist in the provided file
- Dataset is not loaded and a KeyError is logged but not raised all the way to the user (this is expected behavior)
- Ask for a different dataset that is present in the file
- Reader gets asked for both the failed dataset and the newly requested dataset and see log message again
I honestly didn't code for this because I didn't think of the case where a file might not have a dataset it is "supposed" to have. I've tested this both with the viirs_sdr
reader and the native_msg
reader and the reader does indeed get asked multiple times for the failed dataset which is not desired. It was less noticeable in VIIRS SDR because it fails a little earlier in the process and only prints a single warning log message.
I'll fix this so if a dataset fails to load it isn't re-requested.
from satpy.
This should now be fixed in develop. I texted it with the above seviri case and added a unit test for the behavior. Let me know if you see any issues with this.
from satpy.
Related Issues (20)
- Refactoring the Scene with accessors HOT 1
- geotiff writer fails with dask distributed HOT 2
- Confusing documentation for creating a Scene without a filename or reader HOT 6
- Help about Netcdf Data HOT 6
- cf_writer adds a _FillValue = NaN to coordinate variables HOT 1
- `gpm_imerg` reader not supporting IMERG V07
- Resampling flash_duration fails with a ValueError exception HOT 4
- Unexpected floats when reading LI L2 LFL data HOT 1
- MTG LI data HOT 5
- Typo or wrong syntax in examples setting chunk size - documentation HOT 1
- LI L2 Accumulated products retrieved from archive ("ARC" 10-min files) have faulty reading HOT 2
- Something is wrong with ami_l1b reader HOT 2
- Documentation takes too long to build HOT 4
- Trying to add VIIRS L2 data product to viirs_l2 reader and getting errors HOT 14
- ninjogeotiff writer should write gradient for P mode images
- nwcsaf-geo reader turns uint8 into int64 on numpy 2.0
- Prepare for Satpy 1.0
- NWCSAF GEO images black with numpy 2 HOT 1
- Add the functionality to select single repeat cycles/timesteps for LI L2 accumulated archive (ARC) data
- The `ahi_hsd` reader returns Brightness Temperatures as `float64` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from satpy.