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

msg_native example #62

Closed
jakeri opened this issue Sep 2, 2017 · 8 comments
Closed

msg_native example #62

jakeri opened this issue Sep 2, 2017 · 8 comments
Assignees
Labels

Comments

@jakeri
Copy link

jakeri commented Sep 2, 2017

Can someone write a small example on how to use the msg_native driver?

I tried:
global_scene = Scene(filenames="MSG1-SEVI-MSG15-0201-NA-20080131234240.880000000Z-20110506121050-1224354-2.nat", platform_name="Meteosat-10", sensor="seviri", reader="native_msg",base_dir="/mnt/LC3950L4/")

But I guess it is related to the
file_patterns: ['{satid:4s}-{instr:4s}-MSG{product_level:2d}-0100-NA-{processing_time1:%Y%m%d%H%M%S.%f}000Z-{processing_time2:%Y%m%d%H%M%S}-{order_id:d}.nat']

Can I override this id somehow and just send in the file?

@djhoese
Copy link
Member

djhoese commented Sep 2, 2017

filenames must be passed as a list to the Scene creation. Try adding [ and ] round your filename string.

@ghost
Copy link

ghost commented Sep 2, 2017

I tried that too. Should it be possible to specify a full file path?

I would like to skip file_patterns-handling when using nat files. If possible.

>>> import os
>>> from satpy import Scene
>>> from datetime import datetime
>>> from satpy.utils import debug_on
>>> 
>>> debug_on()
>>> global_scene = Scene(filenames=["/mnt/LC3950L4/MSG1-SEVI-MSG15-0201-NA-20080131234240.880000000Z-20110506121050-1224354-2.nat"], platform_name="Meteosat-10", sensor="seviri", reader="native_msg")
[DEBUG: 2017-09-02 19:56:35 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/usr/local/lib/python2.7/dist-packages/satpy/etc'
[DEBUG: 2017-09-02 19:56:35 : satpy.readers] Reading ['/usr/local/lib/python2.7/dist-packages/satpy/etc/readers/native_msg.yaml', '/usr/local/lib/python2.7/dist-packages/satpy/etc/readers/native_msg.yaml', '/usr/local/lib/python2.7/dist-packages/satpy/etc/readers/native_msg.yaml']
[WARNING: 2017-09-02 19:56:35 : satpy.readers.yaml_reader] No filenames found for reader: native_msg
[WARNING: 2017-09-02 19:56:35 : satpy.readers] Don't know how to open the following files: set(['/mnt/LC3950L4/MSG1-SEVI-MSG15-0201-NA-20080131234240.880000000Z-20110506121050-1224354-2.nat'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/satpy/scene.py", line 102, in __init__
    metadata=metadata)
  File "/usr/local/lib/python2.7/dist-packages/satpy/scene.py", line 150, in create_reader_instances
    metadata=metadata)
  File "/usr/local/lib/python2.7/dist-packages/satpy/readers/__init__.py", line 357, in __call__
    raise ValueError("No supported files found")
ValueError: No supported files found

@ghost
Copy link

ghost commented Sep 2, 2017

Found that problem. Found out the problem with the default file_pattern. I had MSG1-SEVI-MSG15-0201-NA-20080131234240.880000000Z-20110506121050-1224354-2.nat but the globify-pattern dictated ????-????-MSG??-0100-NA-??????????????.*000Z-??????????????-*.nat, i.e 0100 vs 0201.

And now next problem. :-)

AttributeError: 'NativeMSGFileHandler' object has no attribute 'metadata'

>>> global_scene = Scene(filenames=["MSG1-SEVI-MSG15-0201-NA-20080131234240.880000000Z-20110506121050-1224354-2.nat"], platform_name="Meteosat-10", sensor="seviri", reader="native_msg")
[DEBUG: 2017-09-02 20:21:10 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/mnt/pytroll/satpy-config/'
[DEBUG: 2017-09-02 20:21:10 : satpy.readers] Reading ['/usr/local/lib/python2.7/dist-packages/satpy/etc/readers/native_msg.yaml', '/mnt/pytroll/satpy-config/readers/native_msg.yaml', '/mnt/pytroll/satpy-config/readers/native_msg.yaml']
[DEBUG: 2017-09-02 20:21:10 : satpy.readers.yaml_reader] Assigning to native_msg: ['MSG1-SEVI-MSG15-0201-NA-20080131234240.880000000Z-20110506121050-1224354-2.nat']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/satpy/scene.py", line 102, in __init__
    metadata=metadata)
  File "/usr/local/lib/python2.7/dist-packages/satpy/scene.py", line 150, in create_reader_instances
    metadata=metadata)
  File "/usr/local/lib/python2.7/dist-packages/satpy/readers/__init__.py", line 340, in __call__
    reader_instance.create_filehandlers(loadables)
  File "/usr/local/lib/python2.7/dist-packages/satpy/readers/yaml_reader.py", line 594, in create_filehandlers
    filename_set)
  File "/usr/local/lib/python2.7/dist-packages/satpy/readers/yaml_reader.py", line 583, in new_filehandlers_for_filetype
    return list(filtered_iter)
  File "/usr/local/lib/python2.7/dist-packages/satpy/readers/yaml_reader.py", line 545, in filter_fh_by_area
    for filehandler in filehandlers:
  File "/usr/local/lib/python2.7/dist-packages/satpy/readers/yaml_reader.py", line 513, in filter_fh_by_time
    for filehandler in filehandlers:
  File "/usr/local/lib/python2.7/dist-packages/satpy/readers/yaml_reader.py", line 557, in filter_fh_by_metadata
    if (key in filehandler.metadata and
AttributeError: 'NativeMSGFileHandler' object has no attribute 'metadata'

@jakeri
Copy link
Author

jakeri commented Sep 3, 2017

After looking at the code, I think there is a bug in 0.7.1. I reverted back to 0.7.0 and msg_native worked fine. It seems to be related to metadata handling in reader.

@djhoese
Copy link
Member

djhoese commented Sep 3, 2017

Good find @jakeri. This is probably a bug from @mraspaud's recent pull request: #58

@djhoese
Copy link
Member

djhoese commented Dec 4, 2017

@mraspaud Could you test this if you have the time?

@mraspaud
Copy link
Member

mraspaud commented Dec 5, 2017

I don't get this error in the feature-xarray branch

mraspaud added a commit that referenced this issue Dec 5, 2017
@sjoro
Copy link
Collaborator

sjoro commented May 8, 2018

Fixed and merged to develop

@sjoro sjoro closed this as completed May 8, 2018
adybbroe added a commit to adybbroe/satpy that referenced this issue Dec 2, 2021
adybbroe added a commit to adybbroe/satpy that referenced this issue Dec 2, 2021
Merge pull request pytroll#62 from adybbroe/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants