-
Notifications
You must be signed in to change notification settings - Fork 17
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
Plugin not working for .hdf MODIS data #22
Comments
Could you let me know which version of CIS and the other libraries you are using? Feel free to attach a print out of your environment. |
Dear Duncan,
I am not sure whether this is what you are looking for but I have attached the output of the printenv command on Linux. When I type in cis version it outputs
Using CIS version: 1.7.1 (Stable)
If this is not the right information then let me know!
Best wishes,
Tasmin
…________________________________
From: Duncan Watson-Parris <[email protected]>
Sent: 09 August 2019 17:49:56
To: cedadev/cis <[email protected]>
Cc: Tasmin Sarkany <[email protected]>; Author <[email protected]>
Subject: Re: [cedadev/cis] Plugin not working for .hdf MODIS data (#22)
Could you let me know which version of CIS and the other libraries you are using? Feel free to attach a print out of your environment.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#22?email_source=notifications&email_token=AM3S3X3NNSQK4W5A6QY37ODQDWN3JA5CNFSM4IKVVOEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD37GINA#issuecomment-519988276>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AM3S3X5FYNMZMRJNLJQRFRTQDWN3JANCNFSM4IKVVOEA>.
|
OK, that's a nice recent version of CIS. To get the versions of the other Python packages could you send the output of running the command: |
Created a new python 3 environment with cis to test this, getting the same error. The problem is in MODIS_L2.__field_interpolate on line 247 of cis/data_io/products/MODIS.py. I believe that all the slice indices now need to be specifically int type due to changes in numpy. The full error output is as follows: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): |
Ah yeah, more specifically it's because this value in the slicing [(-1 * factor / 2 + 1)] isn't converted to int type |
This is the output of conda list packages in environment at /home/linc4371/miniconda3:Name Version Build Channel_libgcc_mutex 0.1 main |
It looks like the easiest fix is to replace float division / with integer division // in those lines. Any obvious reason why that wouldn't work? |
That floors the number, doesn't it? If so, would that break compatibility with the previous functionality? |
numpy would previously select index 0 for 0.5. The only problem is trying to find out if the value was floored or cast as int when indexing, as that changes the behaviour for negative values |
Trying it in my own code doesn't work as you end up with a 2030x1350 coordinate and a 2030x1354 data field. It appears some rounding was being done somewhere. |
To be honest, I'm keen to remove this code entirely since there are a few nasty cases which I'm not convinced it's properly dealing with, this issue of the 4 'missing' coordinates being one of them. This is a first go at making this work with the python-geotiepoints package, which is probably the best way to tackle this: https://github.com/duncanwp/cis_plugins/blob/master/modis_fixed.py The MOD06 and MOD04 products seem to have slightly different structures though so it still isn't working as generally as I'd like. |
I am trying to read a HDF file using the cis.read_data() function in Python.
import cis
import iris
from cis import read_data
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
a=cis.read_data('MOD06_L2.A2008001.0000.061.2017287164540.hdf','Cloud_Effective_Radius_16')
When I run this an error comes up:
ProductPluginException: An error occurred retrieving data using the product MODIS_L2. Check that this is the correct product plugin for your chosen data. Exception was TypeError: slice indices must be integers or None or have an __index__ method.
The same thing happens when I put in 'MODIS_L2' explicity as the plugin in the cis.read_data() function.
Am I using the wrong plugin? If not, then I can't work out how to read the file.
The text was updated successfully, but these errors were encountered: