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

Sea Ice issue #22

Open
mburgass opened this issue Mar 14, 2017 · 5 comments
Open

Sea Ice issue #22

mburgass opened this issue Mar 14, 2017 · 5 comments

Comments

@mburgass
Copy link

Hiya,
I’m working through the sea ice scripts and am really stuck with a particular error. I am making the maps for my regions as suggested here:

https://github.com/OHI-Science/ohiprep/blob/master/globalprep/hab_seaice/v2016/hab_seaice_dataprep.Rmd

and have reprojected my regions following PreparingSpatialFiles.R and I have adjusted ObtainingData.R for my system – I think correctly, but when I try to source it following hab_seaice_dataprep.Rmd I get the same error:

Error in .local(x, filename, ...) :
Attempting to write a file to a path that does not exist:
prep/spatial/pts/tmp2/n_type.tif

I created the path so I think it does exist – I have tried being more explicit, putting the full link in to the code, but it still does not work. I was just wondering if anyone has come across this and where I might be going wrong?

Thanks

@jamiecmontgomery
Copy link
Contributor

Hi @mburgass

Have you walked through ObtainingData.R to see what line is throwing this error? If so, could you point me to it?

@mburgass
Copy link
Author

Hey - yeh I have. Seems to be line 102

writeRaster(r_type, file.path(maps, sprintf('pts/tmp2/%s_type.tif',p), overwrite=T))

@jamiecmontgomery
Copy link
Contributor

Hi @mburgass

It looks like a file.path error. Here, you have

writeRaster(r_type, file.name= (maps, sprintf('pts/tmp2/%s_type.tif',p)), overwrite=T))

but since maps is a file.path defined in hab_seaice_dataprep, you'll need to change it to:

writeRaster(r_type, file.path(maps,sprintf('pts/tmp2/%s_type.tif',p)), overwrite=T)

I think there was also an extra parentheses in there. Try that and let me know how it goes

@mburgass
Copy link
Author

Hey - yes this worked thank you. It started running the script and processing all 888 rasters. This was running great up until around 220 when I got this error:

[1] "Retrieving n199705 (221 of 888). Minutes done=61.5, to go=185.5"
Error in setValues(r, x) :
length(values) is not equal to ncell(x), or to 1

I carried on running the script and have also had this problem with 251 and 260. I'm not sure why the error would only occur for a few of these? Is it a big problem?

Thanks,
Mike

@jamiecmontgomery
Copy link
Contributor

@mburgass - I'm not familiar with this script (@Melsteroni worked on this for the global assessment), but I would suggest pulling out those two rasters and running the script step by step on one of them to see where it is hitting the error. Or maybe just looking at those two rasters by plotting them you will see why they are throwing errors - maybe they are all NA?

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

2 participants