-
Notifications
You must be signed in to change notification settings - Fork 303
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
Creating a Scene object with NOAA-15/18 data #350
Comments
Thanks for reporting this. Would you please confirm that these datafiles was created with AAPP? if so, could share one of the files for further testing? |
Unfortunately I won't be able to confirm this until Monday when my colleague becomes available, sorry for the inconvenience. |
no problem, Monday is fine |
Great! I'll get back to you then. |
@mraspaud I can confirm that this datafile was created with AAPP, would you still like me to share the file with you? |
yes please! |
Ok, I'll send it to you via mail. |
Thanks, I got it. Looking at the file with
But you can see that what we are interested in starts at byte 512 (0001000)... So something is adding a chunk of 512 bytes in the beginning of your files it seems. Removing those 512 bytes from the file makes it readable by satpy: |
Thanks again! perhaps the same header is being added to the NOAA-18 data aswell, I'll have a look at it when I get the chance. |
@mraspaud I'm have some difficulty implementing the code for removing the 512 first bytes, seeing as how you managed to plot the satellite data you were able to remove or skip the header? |
@Krangaas I used bash to do that, with def read(self):
"""Read the data.
"""
tic = datetime.now()
offset = 0
with open(self.filename, "rb") as fp_:
if fp_.read(6) == b"NOTAPP":
offset = 512
header = np.memmap(self.filename, dtype=_HEADERTYPE, offset=offset, mode="r", shape=(1, ))
data = np.memmap(self.filename, dtype=_SCANTYPE, offset=offset + 22016, mode="r")
logger.debug("Reading time %s", str(datetime.now() - tic))
self._header = header
self._data = data But to accept that into satpy, we would have to make sure to know the source of these bytes and that they are always 512 bytes long... |
I'm not sure why the 512 byte chunk is added to the data but I believe it will be avoided in the future. I'll try what you suggested, thanks! |
Code Sample, a minimal, complete, and verifiable piece of code
import os
from satpy import Scene
from satpy.utils import debug_on
debug_on()
BASEDIR = "C:\scrypts\K5"
FILES = os.path.join(BASEDIR, "hrpt_noaa15_20180330_1618_03429.l1b")
global_scene = Scene(reader="avhrr_aapp_l1b", filenames = [FILES])
Problem description
I'm having difficulty creating a scene object with NOAA-15 data, I'm unsure of what the problem is. I get the same error when using NOAA-18 data.
Expected Output
I want to create a scene object, load the channels and create a composite of the data.
Actual Result, Traceback if applicable
(base) C:\scrypts>python SatPy_NOAA.py
[DEBUG: 2018-06-29 14:18:38 : satpy.scene] Setting 'PPP_CONFIG_DIR' to 'C:\Users\magnus\Anaconda2\lib\site-packages\satpy\etc'
[DEBUG: 2018-06-29 14:18:38 : satpy.readers] Reading ['C:\Users\magnus\Anaconda2\lib\site-packages\satpy\etc\readers\avhrr_aapp_l1b.yaml', 'C:\Users\magnus\Anaconda2\lib\site-packages\satpy\etc\readers\avhrr_aapp_l1b.yaml', 'C:\Users\ma
gnus\Anaconda2\lib\site-packages\satpy\etc\readers\avhrr_aapp_l1b.yaml']
[DEBUG: 2018-06-29 14:18:38 : satpy.readers.yaml_reader] Assigning to avhrr_aapp_l1b: ['C:\scrypts\K5\hrpt_noaa15_20180330_1618_03429.l1b']
Traceback (most recent call last):
File "SatPy_NOAA.py", line 10, in
global_scene = Scene(reader="avhrr_aapp_l1b", filenames = [FILES])
File "C:\Users\magnus\Anaconda2\lib\site-packages\satpy\scene.py", line 150, in init
reader_kwargs=reader_kwargs)
File "C:\Users\magnus\Anaconda2\lib\site-packages\satpy\scene.py", line 195, in create_reader_instances
ppp_config_dir=self.ppp_config_dir)
File "C:\Users\magnus\Anaconda2\lib\site-packages\satpy\readers_init_.py", line 589, in load_readers
reader_instance.create_filehandlers(loadables)
File "C:\Users\magnus\Anaconda2\lib\site-packages\satpy\readers\yaml_reader.py", line 487, in create_filehandlers
filename_set)
File "C:\Users\magnus\Anaconda2\lib\site-packages\satpy\readers\yaml_reader.py", line 474, in new_filehandlers_for_filetype
return list(filtered_iter)
File "C:\Users\magnus\Anaconda2\lib\site-packages\satpy\readers\yaml_reader.py", line 447, in filter_fh_by_metadata
for filehandler in filehandlers:
File "C:\Users\magnus\Anaconda2\lib\site-packages\satpy\readers\yaml_reader.py", line 391, in new_filehandler_instances
yield filetype_cls(filename, filename_info, filetype_info, *req_fh)
File "C:\Users\magnus\Anaconda2\lib\site-packages\satpy\readers\aapp_l1b.py", line 78, in init
self.read()
File "C:\Users\magnus\Anaconda2\lib\site-packages\satpy\readers\aapp_l1b.py", line 135, in read
data = np.memmap(fp_, dtype=_SCANTYPE, offset=22016, mode="r")
File "C:\Users\magnus\Anaconda2\lib\site-packages\numpy\core\memmap.py", line 236, in new
raise ValueError("Size of available data is not a "
ValueError: Size of available data is not a multiple of the data-type size.
Versions of Python, package at hand and relevant dependencies
OS: Windows 7
SatPy Version: 0.9.0b0
PyResample Version: 1.10.0
Python version: 2.7
The text was updated successfully, but these errors were encountered: