Search code examples
pythonsatpy

Why do I using satpy on Himawari-8 standard data failed?


When I use satpy to read Himawari-8 standard datas, the terminal always says " 'filenames' was provided but is empty. "

The Himawari-8 has 16 observation bands, and it take one full disk picture every 10 minutes so for one folder of observation result which contains 16 folders(one folder is one band), and each band is separated into 10 parts so in one band folder it has 10 files.
The format of Himawari-8 standard data is .dat, and the data named as HS_aaa_yyyymmdd_hhnn_Bbb_cccc_Rjj_Skkll.DAT.

H08: Himawari-8
yyyy: Observation start time(year)
mm: Observation start time(month)
dd: Observation start time(day)
hh: Observation start time(hour)
nn: Observation start time(min.)
bb: Band number (01 – 16)
cccc: Observation area and number, FLDK: Full Disk
jj: Spatial resolution 
kk: segment number (01 – 10)
ll: total number of segments (01 – 10)

e.g. HS_H08_20210518_1100_B01_FLDK_R10_S0110.DAT

These are the all message from vscode:

(my_satpy_env) E:\HK\Python>python Process_SatHima_Imagery.py
Traceback (most recent call last):
  File "E:\HK\Python\Process_SatHima_Imagery.py", line 18, in <module>
    scn = Scene(filenames=files,  reader='ahi_hsd',filter_parameters={'start_time': datetime(2021,5,25,2,00), 'end_time': datetime(2021,5,25,2,10)})
  File "C:\Users\RSFBioL\anaconda3\envs\my_satpy_env\lib\site-packages\satpy\scene.py", line 108, in __init__
    self._readers = self._create_reader_instances(filenames=filenames,
  File "C:\Users\RSFBioL\anaconda3\envs\my_satpy_env\lib\site-packages\satpy\scene.py", line 157, in _create_reader_instances
    return load_readers(filenames=filenames,
  File "C:\Users\RSFBioL\anaconda3\envs\my_satpy_env\lib\site-packages\satpy\readers\__init__.py", line 546, in load_readers
    raise ValueError("'filenames' was provided but is empty.")
ValueError: 'filenames' was provided but is empty.

I use the code from Github and he uploaded the code " https://github.com/gSasikala/ftp-himawari8-hsd/blob/main/examples/Processing_Satellite_Imagery.ipynb "

I use the editor, vs code, to write and the python version is 3.9.7 and I have installed anaconda and satpy to my computer.

Sorry that I'm a newbie at Python and Himawari-8 standard data, if there anything I missed just remind me. Thanks for any reply or recommand to me.


Solution

  • The error message means that you are passing an empty list to the Scene object. So in this line of code (you can see it in the error traceback):

    scn = Scene(filenames=files,  reader='ahi_hsd',filter_parameters={'start_time': datetime(2021,5,25,2,00), 'end_time': datetime(2021,5,25,2,10)})
    

    your files variable is an empty list ([]). Satpy can't load anything because it wasn't given any files. The notebook you linked to creates the files variable with this line of code:

    files = glob.glob(r'D:\ftp_h8_hsd_25Jul\*.dat')
    

    Which means get a list of all of the files ending with .dat in the directory D:\ftp_h8_hsd_25Jul\. This is a directory (folder) on the author of the notebook's Windows machine. If you don't have these data files on your local machine then you will need to download them from somewhere. If you have the files, then you need to change the D:\ftp_h8_hsd_25Jul\*.dat part of the code to match your download location. For example, if you are on linux and downloaded the files using a browser they may be in /home/<username>/Downloads/*.dat.

    It isn't clear to me what you are trying to do or what your starting point is so I'm not sure I can help much further. Stackoverflow isn't the most widely used support forum for Satpy questions. If you'd like to chat more I'd suggest joining the Pytroll slack (see http://pytroll.github.io/#getting-in-touch), we'd be happy to help.