This forum is shutting down! Please post new discussions at community.naturalcapitalproject.org

Wind Model Run Error

Hi all,

I'm trying to run the Wind Model in Alaska, and get an "AttributeError encountered: 'NoneType' object has no attribute 'GetFieldIndex'. I've tried running for other regions (e.g., west coast US), and don't get this problem, so I wonder if it's related to the error a user reported back in February, which had to do with the re-projection. I'm using InVEST 3.2.0, which I believe has the patch from the previous problem.

I've attached the log file and the AOI shapefile. Many thanks for any help.

Regards,
Malin


Comments

  • DougDoug Administrator, NatCap Staff
    Hi Malin,

    I apologize for the late reply. This does look really similar to that other post. I downloaded your AOI and looked at it in QGIS. It seems to be projected in Meters but the projection does look a bit strange to me, not that I'm overly familiar with projections. 

    I'm going to try running the model on my side with your AOI and see what I can find. I'll also give an attempt at projecting your file into a UTM format to see if that makes a difference.

    Thanks for your patience, more soon.

    Doug
  • DougDoug Administrator, NatCap Staff
    edited January 2016
    Hi Malin,

    I was able to reproduce the same error given the Alaska shapefile. It definitely looks like it is a projection issue. Could you say in which region of Alaska the AOI is covering? Given a region I can try to project the AOI into a UTM zone and see if that has a better result.

    Off hand it looks like the current projection used is for the artic circle, and when the model tries to project the lat / long bathymetry and land polygons,it gets a little funky. You can take a look at what I mean in your "workspace/intermediate/bathymetry_projected.tif"

    Cheers,

    Doug
    Post edited by Doug on
  • Hi Doug,

    Thanks so much for taking a look at this. The AOI covers a wide region, (eastern Bering Sea to southeast AK), but UTM zone 3N seems like a decent compromise. I tried projecting the AOI into the new coordinate system, but ran into the same error. New AOI and log file attached.

    I also tried taking a look at the bathymetry_projected.tif file, and as far as I could tell, it's filled with nan values instead of depth. That doesn't seem like a good sign!

    Thanks again for any thoughts or help.

    Regards,
    Malin
  • Hi Doug,

    A bit more of an update: the issue seems to be right around 180° longitude. If I split the Alaska AOI shapefile into three pieces: 1) less than 179° longitude, 2) 179° to -179° longitude, and 3) greater than -179° longitude, only the middle piece fails to run. I also tried splitting out the Aleutian Islands, which cross 180°, and that part failed while the rest of Alaska worked.

    Perhaps it's something with the re-projection that the script does? Some projections don't work well around 180° longitude. As in my last post, though, I did try using UTM zone 3N, and that didn't solve the problem.

    Shapefiles of the three pieces attached, along with the log file for the middle piece that fails.

    Thanks again for any thoughts.

    Regards,
    Malin
  • DougDoug Administrator, NatCap Staff
    Hey Malin,

    Thanks for flushing this out a bit, much appreciated. It does sound like there is something 
    strange happening around that 180 degree mark. I'll take a look at the files you sent and 
    see if I can find where the model is struggling with the projection. 

    Thanks!

    Doug
  • DougDoug Administrator, NatCap Staff
    Hi Malin,

    Just wanted to give a quick update.

    The model attempts to take the projected AOI and "re-project" / "un-project" it into Lat/Long WGS84. It does this so that we can properly clip the other inputs like the global polygon and bathymetry. Once these inputs are clipped they can then be projected into the desired meters projection of the AOI.

    Since the AOI / area you are looking at happens to be at that 180 degree longitude mark, it looks like the "re-project" / "un-project" is struggling to correctly place the pieces and extents. I believe this is because, WGS84 has bounds of -180, -90, 180, 90.

    To demonstrate I have attached a screenshot of AOI_west projected to WGS84 and AOI_east projected to WGS84 (top). You'll notice how they get separated / wrapped around "the edge of the WGS84 projection". Also note what happens to that AOI_middle section when projected to WGS84 (bottom).

    I'll be looking into the proper way to handle such cases as this. Thanks for your patience and helping us improve our models!
    1547 x 365 - 10K
  • Hi Doug,

    At least glad you can re-create the problem! The image you sent looks familiar. Using QGIS, I've seen the same "inversion" of polygons that cross 180 and were reprojected into WGS84 lat/lon coordinates.

    I've tried clipping the polygons right on 180, and that also failed, but I'll try clipping just a hair off (say, 179.99 and -179.99) to see if I can get a work-around in the short term.

    Many thanks for your help.

    Cheers,
    Malin
  • DougDoug Administrator, NatCap Staff
    Hi Malin,

    Yea sorry about that. It's one of those cases we have yet to come across. I posted on gis.stackexchange looking for input from other GIS users.


    Might provide a better summary / visual of what is happening as well, for anyone else that finds this thread. Will continue to work toward a solution for the model.

    Regards,

    Doug
Sign In or Register to comment.