I have successfully tested the HRA model with the pre-fab data that comes with it. To get more acquainted with it I wanted to run it with own data, first for testing purposes and later maybe research purposes. I simplified some spatial stressor and habitat data, made up the table with criteria ratings with ± random ratings between 1 & 3 (to not have to delve in literature for X days before running). I made the habitat stressor info table with the appropriate paths & randomish buffer values.
So the interface gives me a green V to everything but the Area of Interest (Vector), where the red X says it’s not what the model wants. If I hit run anyway to see what’s up exactly, I get the following:
“Validation warnings found: … please fix these errors: Area of Interest (Vector): Data must be projected in linear units.”
So that sounds like it’s very obvious for QGIS acquaintees but it’s not for me (I’m not much more than a QGIS rookie). The area in the .shp that I provide overlaps with the stressor & habitat .shp files. It is, however, a polygon, I’m not sure if that is the issue, I would expect an area of interest to be a polygon and not a line. When I check the pre-fab input data that goes along with the model, the area of interest definitely looks like a polygon too. I feel like I’m missing something very simple.
Thanks in advance for any help and patience with this possible silly case
Although I had been struggling with this since yesterday evening I miraculously found what is the likely issue shortly after posting this topic (my apologies for that). I changed the coordinate system to Belgian Lambert 72 EPSG:31370 which does have units in meters (which is what is meant by the “Data must be projected in linear units”, I know this now). The green V was granted for AOI slot, I ran the model and got the following error:
ParserError encountered: Error tokenizing data. C error: Expected 1 fields in line 3, saw 4
The “run report” below. I will change the CRS of all layers now, too (I expect the model would want everything to be in the same CRS, but the error I get doesn’t seem to address that specifically so possibly there’s something else amiss).
Yes, you’re right about ‘linear units’ referring to the projection units being in meters or some other linear unit! I’m glad that a reprojection of the AOI resolved that issue.
ParserError you mention, could you attach the logfile from your HRA run so we can take a closer look? The one attached is from a run of the InVEST Habitat Quality model.
Thanks for the quick response. My apologies for the wrong logfile, I reran it just now and this should be the right one.
InVEST-Habitat-Risk-Assessment-log-2020-05-21–13_00_35.txt (2.7 KB)
Thanks! So it looks like there’s a formatting issue with one of the rows in the criteria table. Could you attach the criteria table here so we can take a look at that? Thanks!
Here’s the critera table. Had a look and compared with the input criteria table and I can’t see what is wrong straight away.
Thanks in advance!
Did some more clicking and trying around and found that the model doesn’t like it if you transform from text to columns to make changes to the criteria values more easily. Looking for a way now to transform the csv in name to actual csv again (apparently I “broke” the csv part by saving it in columns, although the file is still .csv)
So I managed to get the comma’s back in place with a .txt & pycharm & .txt again detour, but the model still doesn’t want to work with it. This is what it (the exposure consequence criteria table) looks like now:
E_C_criteria_CSVd.csv (6.0 KB)
edit: the current error is a validation error, “File could not be opened as a CSV or Excel file.”
So I tinkered some more, copied the comma separated output from pycharm in excel and saved as .csv (instead of changing the .txt to .csv while saving). It now recognizes it as a file that can be opened as a CSV. However, it now prompts a ValueError: Values in the DQ column for habitat “M_balthica” should be a number, but is “nan”.
The log file from this run:
InVEST-Habitat-Risk-Assessment-log-2020-05-25–14_38_26.txt (7.5 KB)
The exposure consequence criteria table used for this run:
Book1.csv (6.1 KB)
Thank you for your patience and apologies for the spam
Hi @sihernan, I’m so sorry about the delay on this!
I’ve updated some of the quoting in the table here … could you try the attached CSV and see if that works for you? Book1.csv (6.0 KB)
That’s okay, I was also a tad impatient so I made a new thread. My reasoning was that the title of this one didn’t reflect the new issue, so I made a new one where it did. Had some help and it was indeed the “invasive” quotes that sneaked in that messed up the file. Still not sure how they creep in, but now I know I should check for them if I get the is nan error.
Thanks for all the help