Skip to content
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

Fixing Error: Unknown columns 'goal', 'region_id', 'score' #20

Open
jules32 opened this issue Nov 4, 2016 · 0 comments
Open

Fixing Error: Unknown columns 'goal', 'region_id', 'score' #20

jules32 opened this issue Nov 4, 2016 · 0 comments

Comments

@jules32
Copy link
Contributor

jules32 commented Nov 4, 2016

Recently, the OHI+ Arctic (ARC) updated the goal function for NP. When running this function from within functions.r, it was fine. But when running CalculateAll(), it failed.

I investigated it and fixed it, here's my whole troubleshooting process:

From calculate_scores.r:

## run the configure_toolbox.r script to check configuration
source('~/github/arc/circle2016/configure_toolbox.r')

## calculate scenario scores
scores = ohicore::CalculateAll(conf, layers)

Running Setup()...
Calculating Status and Trend for each region for FIS...
Calculating Status and Trend for each region for MAR...
Calculating Status and Trend for each region for AO...
Calculating Status and Trend for each region for NP...
Error: Unknown columns 'goal', 'region_id', 'score'

This error happened in the NP goal function, and from the looks of it it has something to do with the scores variable, which I know should have column headers 'goal', 'region_id', 'dimension', and 'score'.

So I went into functions.r and started running the NP code line by line (which is possible since I already ran configure_toolbox.r):

...and everything worked. So I looked at the scores variable; it has only 3 columns

head(scores)
Source: local data frame [6 x 3]
Groups: rgn_id [3]

  rgn_id dimension score2
   <int>     <chr>  <dbl>
1      1    status  87.50
2      1     trend   0.50
3      2    status  88.00
4      2     trend   0.21
5      4    status  70.50
6      4     trend   0.08

So I've reformatted scores: here are the commits: 839cd4ed and 6f960eb to see exactly how I fixed them line-by-line.

Now, it calculates everything except fails on the Pressures--the next step for ARC will be to make sure the Pressures Matrix represents ARC as it is now before that will work.

But the NP function in functions.r works! Nice job!!

@jules32 jules32 changed the title Toolbox error: Error: Unknown columns 'goal', 'region_id', 'score' Fixing Error: Unknown columns 'goal', 'region_id', 'score' Nov 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant