1

I am trying to run the "Machine learning with the Open Data Cube" using my own .shp file but seem to keep getting the same error. The only cell that I altered in the following link is number 3, and the error then comes up after cell 9: https://docs.dea.ga.gov.au/notebooks/Frequently_used_code/Machine_learning_with_ODC.html

The code works perfectly when I don't alter the shapefile path but as soon as I add my own shape file (available here) it doesn't work anymore. The format of the example .shp file and mine are the same.

The code in the original tutorial for cell 3 was:

path = '../Supplementary_data/Machine_learning_with_ODC/example_training_data.shp'
field = 'classnum'
time = ('2015')
zonal_stats = 'median'
resolution = (-25, 25)
output_crs = 'epsg:3577'

I then customised that using my own shape file in cell 3:

path = '../Supplementary_data/Machine_learning_with_ODC/Trainingv4.shp'
field = 'classnum'
time = ('2015')
zonal_stats = 'median'
resolution = (-25, 25)
output_crs = 'epsg:4326'

Every other cell remained the same and the preview of my shapefile had the same format as the example one (ie class column with integer and then geometry coordinates)

this is the error message that I get

Any suggestions?

4
  • 1
    We cannot help you if you don't provide the information that you modified in the code. Can you please edit your question to show how you altered the cell 3 ? from what we can see on your error, the time lib was not imported in the file classification.py Jul 8, 2021 at 7:16
  • Thanks @PierrickRambaud, I have now added the extra info, any help is appreciated
    – Brianna
    Jul 8, 2021 at 20:34
  • Hey @brianna! We should be able to help out with this, thanks for including the extra detail. Is there any chance you could upload your training shapefile as a .zip to something like Dropbox and include the link here? That way we can see if we can replicate it on our end. Jul 8, 2021 at 22:17
  • 1
    Hello @RobbiBishop-Taylor that would be much appreciated, can access the file here: dropbox.com/sh/ecipagdtyi89qws/AAD9_duez4uZyxQyuUtzz-7ka?dl=0
    – Brianna
    Jul 8, 2021 at 22:32

1 Answer 1

4

I am an author of the notebook and the classification tools library, I've fixed the issue you found. It was a missing import triggered in a particular edge case, in this instance some of your training labels fail to load data. You can access these changes by pulling down the latest develop branch or simply add import time to the classification.py file in DEA Tools. I noted that your data is in CRS EPSG:4326, I reprojected it to albers EPSG:3577 and was able to successfully run through the notebook and complete a classification.

1
  • Thanks Sean for your swift response. I have tried using the new code downloaded from the github site but it seems that there may be a few errors in the updated version that I am unsure how to resolve. After running the first cell (without changing anything) I get the following error: ModuleNotFoundError: No module named 'dea_classificationtools' Even after adding import dea_classificationtools into the cell it will not run
    – Brianna
    Jul 21, 2021 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.