Attribute error: 'NoneType' object has no attribute 'RasterCount'

Dear NatCap team,

I am running the wateryield model for the Paraguay River Basin (1,312,878 km2). I managed to create a LULC raster with quite fine resolution (30 m), but as it turns out the model is not running any more (it was running previously with LULC data with 1km resolution). I am getting the following Attribute error: 'NoneType' object has no attribute 'RasterCount'. I was suspecting I might not be able to run the model for this big area with such a detailed LULC but this error seems to be related to something else, so I still have the doubt whether is a problem of the resolution. 
Could you help me with this?
I attached the full log details.
Thanks a lot!!
Best wishes,
Elena

Comments

  • swolnyswolny Member, NatCap Staff
    Hi Elena -

    Just about every time I've gotten this error, it's related to running out of either disk space or memory, usually disk space. Can you check to see if this is happening?

    ~ Stacie
  • elenaelena Member
    Hi Stacie!

    Thanks a lot for your quick and valuable response!:)  Yes, indeed I encountered a big problem of disk space! The result was occupying more than 300GB. Do you think it makes sense that I try re-running the model and storing the results in an external hard disk with larger storage capacity? Or may be this results' size is too hard handle?

    Thank you so much!! :)
    Best,
    Elena
  • swolnyswolny Member, NatCap Staff
    Wow! That's a lot of space. I believe that the water yield model resamples all of your other inputs to the same cell size as your LULC, so that ends up using a lot of space. If you really need to run it at 30m resolution, then it's certainly worth trying setting your Workspace to a large external disk. Just note that, depending on what type of connection you have to that disk, it can take longer to run, since writing to that disk may be slower than an internal disk.

    ~ Stacie
  • elenaelena Member
    Thanks a lot for your feedback Stacie!! :) I will put it to work in the night :)

    Best,
    Elena
  • RichRich Administrator, NatCap Staff
    Hi Elena, 300GB sounds like a lot for the water yield model.  Do you by any chance know the dimensions of your input raster?  We regularly handle raster sizes of 20k X 20k and more.  Offhand a 300GB dump for that model sounds unreasonable, so I'm worried it might be a bug.  

    You mentioned you attached your log but I don't see it in the thread here.  Would you mind passing that along too?  And worst case I may need your datastack dropboxed to me at richsharp@stanford.edu
  • elenaelena Member
    Hi Rich!

    Thanks a lot for your response! The input raster I am using is 51749 x 52233, and it has a size of 10.07 GB (see attachment for details "Raster_Properties_LULC_30"). 

    I have also attached the log I got when running InVEST with this LULC dataset ("Log_results_LULC_30m").

    As I thought this size of the LULC raster was too big (30m pixel), I resampled it to 90m pixel, providing then InVEST a LULC input raster of 17250 x 17411, and size 1.12 GB. 

    When I did this, then I got the other error I posted in the thread "Wateryield Value Error":
    "ValueError: There was not a value for at least the following codes [ 4  8 13 15 17] for this file D:\GIS\2_Prod\Outcomes\wateryield_workspace_LULC_90\tmp\tmpble0xf. Nodata value is: 255"
    (see the full log also in the attachments "Log_results_LULC_90m").

    I have fully rechecked the entries in the biophysical table and cant find the mistake.

    May be the problem relies in how I created my LULC raster. My study area is quite big, comprising a part of 4 different countries. I had different quite fine LULC datasets for 3 of the countries in shapefile format, so I merged and reclassified these. To cover for the rest of the study area without data, I took the Global Land Cover 2000 dataset, converted it to shapefile and merged to the fine LULC shapefile. Once I finalised reclassifying all my study area data in shapefile format, then I converted it to the LULC raster of 30 m pixel size which is giving so many problems. I have no zero values anywhere, and I think I treated the data respectfully, but may be in one of this steps there is some problem.

    I will be very grateful if you let me know your thoughts about all this!

    Thank you so much!
    Best wishes,
    Elena




  • RichRich Administrator, NatCap Staff
    Hi Elena, the 50k X 50k rasters are pretty big, and the model does need to make several intermediate files.  I don't think there's anything we can reasonably do on our end to get around that.  Is there any chance you could get access to a larger external hard drive and point your workspace to that?  

    But the second issue with the missing landcover types in the 90m rasters is more suspicious.  If you're sure that there are no [ 4  8 13 15 17] codes in your 90m landcover raster and/or there are corresponding entries in the biophysical table, could you dropbox me both of the following files so I can take a look on my end to make sure there isn't a corrupt datafile or somesuch?  My account is at richsharp@stanford.edu:

    * D:/GIS/2_Prod/Used/wateryield_LULC_90/biophysical_wateryield_LULC_90v2.csv
    * D:\GIS\2_Prod\Used\wateryield_LULC_90\lu_uprb_90
  • elenaelena Member
    Hi again Rich,

    I finally discovered the bug: I had stupidly forgotten to reclass the land use classes in my demand table.

    The model is running well with the smaller resolution raster (90m)

    Thanks a lot for your help!
    Best
    Elena
This discussion has been closed.