-
Notifications
You must be signed in to change notification settings - Fork 4
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
'DataFrame' object has no attribute 'cloud_pct' ? #137
Comments
This is due to an unhandled error case where there is no valid satellite imagery for the provided point. Out of curiosity, did you run This bug was fixed in a recent PR (#136) but a new release hasn't been cut yet. In the meantime, you can install the latest from github. A release including this fix will be coming shortly! |
I tried both. predict-point for a single point and predict for a csv. I get same error each time! |
Multiple images are downloaded because we use a 30 day look back period; images are downloaded for the full period and then the most recent image where the bounding box around the sample contains less than 5% cloud pixels is used. Can you share the input csv and point (lat, lon, date) that you used so I can reproduce the error? If the image is indeed cloud free, it's possible that no water pixels are detected, since we filter to the water pixels in the bounding box. |
Yes I can provide you the points once back to my office laptop. Meanwhile, you said that you are masking data to get only water, this raised a question for me, do estuaries masked also? because it can be ambiguous whether classify them as inland or sea water (as I understand, a land-sea mask is used, right?). Sorry for all this questions ! and Thank you for your reactivity! |
Here is the points: Also, for the code, I think it will be better to check first if the images at the given dates are cloudy or not and (if yes) then search for the closest date of a cloud free image (a cloud scoring could be done also). These are just suggestions based on your feedback. I don't know how the code works (as I didn't checked the source code yet) so forgive me if I got things wrong. |
@yhouali I'm not able to reproduce your error. Using cyfi version 1.1.2, I saved those points in a csv called This is the corresponding output file
|
To answer your other questions:
We use Sentinel 2's scene classification band to identify water pixels
Since users can specify a different max cloud threshold, we download the imagery and save to disk a numpy array of the bounding box around the point before cloud filtering is done. Because downloaded imagery is cached, it is then easy for a user to change the max cloud percent without having to re-download any imagery. You're correct that there is a design decision trade off in downloading all the imagery first. |
I'm going to close this issue since I was able to generate predictions for your points without error using the latest available release. Feel free to re-open if you continue to encounter issues. |
Dear Emily, thank you very much for your reactivity, assistance and all the information and explanations ! The points you sent me are useful for now. I will try just after to solve the problem! Best regards, |
@yhouali, Did you ever resolve this issue? I'm encountering the same problem. I have cyfi v 1.1.3 installed on my machine (windows). I've tried using both my own points/dates as well as those provided in the quick start guide as examples but unfortunately receive the same error as was documented previously: "AttributeError: 'DataFrame' object has no attribute 'cloud_pct'". I have also tried both 'cyfi predict-point' and 'cyfi predict' and get the same error. The traceback does show that I'm able to successfully load the sample points, and successfully download the associated satellite imagery Data input (from quickstart) Traceback: |
@NickSievert Can you share a few more details of your setup so we can reproduce it? We have not yet been able to with cyfi 1.3.3 and python 3.10 or 3.12. Which version of python are you using? How did you install cyfi (pip vs. conda-forge)? |
Thank you so much for your prompt response. The issue appears to be a network security issue on my end rather than a problem with your package. I will follow-up to confirm resolution via a network security solution for others reference but I believe this issue can be closed. I am using python v 3.12 When attempting to download the satellite imagery via a manual script I get the following error: I will work with my IT program to address this network issue. I overlooked the satellite download initially because although it indicated that errors were raised in downloading it concluded with the message "2024-10-17 14:49:41.888 | SUCCESS | cyfi.pipeline:_prepare_features:117 - Downloaded satellite imagery" Debugging satellite download traceback: Traceback manual sentinel 2 tile download: import numpy as np with rasterio.open(asset_href) as ds: Traceback (most recent call last): |
The text was updated successfully, but these errors were encountered: