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

Calculating scores with updated CS layer – Bali #29

Open
jules32 opened this issue Jan 12, 2018 · 0 comments
Open

Calculating scores with updated CS layer – Bali #29

jules32 opened this issue Jan 12, 2018 · 0 comments

Comments

@jules32
Copy link
Contributor

jules32 commented Jan 12, 2018

Working with @rftapilatu, we saved and registered an updated hab_mangrove_extent layer for bali (commit).

Then, we reran calculate_scores.Rto check that this had worked, but we got the following errors. This is a record of how I troubleshooted to see what was going on and fixed the problems so that we could recalculate OHI scores with this updated data layer. All these errors turned to be because of the way we had structured this updated data layer. The main thing is that when you substitute an existing data layer, make sure that it has the same structure as the global one, or you'll need to update the code to accommodate any differences.

Error: by can't contain join column "year" which is missing from RHS. This was obviously something to do with the "year" column in our new layer, but I didn't see it at first. I walked through the CS function line-by-line and then realized that the problem was that our layer had a column named years but it should have been year (commit).

I tried rerunning calculate_scores.R again and got past that error to a new one:
Error in rbind(deparse.level, ...) : numbers of columns of arguments do not match.

This is because the other hab_* layers have an additional column called habitat. Fixed with this commit.

That got us past that error and onto another one: Error in match.names(clabs, names(xi)) : names do not match previous names.

This is because the data for seagrass and saltmarsh are measured in square kilometers, not hectares. I'm not sure if the Bali team will end up removing these habitats or not, but for the meantime, I translated hectares to km2 and re-saved the layer (commit)

Next error: Error in match.names(clabs, names(xi)) : names do not match previous names.

This was because I had forgotten to update layers.csv, where we had registered "hab_mangrove_extent" as having units of "area_ha". Once I updated layers.csv, it ran correctly!


Updating this layer actually affected scores for CS, CP, BD, and the overall Index score (commit. It will be important to revisit functions.r and make sure that the global models and reference points are appropriate for Bali.

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