andysouth / climcropr

R package for simple crop modelling at global scale
MIT License
4 stars 5 forks source link

Is it worth thinking about using rappdirs for this? #1

Closed adamhsparks closed 7 years ago

adamhsparks commented 7 years ago

I'm reading your comments about gunzip deleting files, etc. and was thinking that perhaps it's useful to consider using rappdirs for storing these data for repeated use?

If so I can work on it and submit a pull request if you'd like?

I did this with my getCRUCLdata package to save the user repeated downloads.

andysouth commented 7 years ago

Thanks Adam, That looks interesting. I'm still experimenting with what I want to do at the moment, but may get back to you on this, I wasn't aware of rappdirs. Also your CRU package looks very cool. I'll be in touch. Andy

On 17 June 2017 at 08:34, Adam H. Sparks notifications@github.com wrote:

I'm reading your comments about gunzip deleting files, etc. and was thinking that perhaps it's useful to consider using rappdirs https://github.com/r-lib/rappdirs for storing these data for repeated use?

If so I can work on it and submit a pull request if you'd like?

I did this with my getCRUCLdata https://github.com/ropensci/getCRUCLdata package to save the user repeated downloads.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AndySouth/climcropr/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5tRe9xf6IlhaJW4A1l2vrsmfSKGfUTks5sE4GhgaJpZM4N9KEU .

adamhsparks commented 7 years ago

No worries. I was thinking that this might be a good use case. I don't know what you envision yet, but I was thinking that a user might want to compare different climate or weather data sets for the same crop so having the MIRCA crop data cached locally could be useful or even just rerunning the same code and not downloading over and over.

cheers!

andysouth commented 7 years ago

You're right. In the short term I've just been trying to get a comparison working for a few select crops. I was wondering whether to just store all the data in the package, but may take up too much space for cran and good to have the option to download other layers too. So if you are to happy to submit a PR then I'll be happy to receive !

On 19 Jun 2017 21:28, "Adam H. Sparks" notifications@github.com wrote:

No worries. I was thinking that this might be a good use case. I don't know what you envision yet, but I was thinking that a user might want to compare different climate or weather data sets for the same crop so having the MIRCA crop data cached locally could be useful or even just rerunning the same code and not downloading over and over.

cheers!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/AndySouth/climcropr/issues/1#issuecomment-309564189, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5tRXkNs6BnTmaGJmVYC_OwYd-svA6Hks5sFtnlgaJpZM4N9KEU .

adamhsparks commented 7 years ago

PR sent.

I've done my best to write some tests and eliminate messages when checking the package.

andysouth commented 7 years ago

Hi Adam, The code looks really great, great to have a test too. Thanks.

A glitch when I try to run it, is this a problem with my setup ? Andy

plot(get_mirca('maize'))

Downloading requested MIRCA file.

Error in value[3L] : The file download has failed.

Please start the download again. In addition: Warning message: In dir.create(cache_dir) : cannot create dir 'C:\Users\andy\AppData\Roaming\climcropr\climcropr', reason 'No such file or directory'

adamhsparks commented 7 years ago

Hi Andy, Something isn't right yet. Let me look into it.

adamhsparks commented 7 years ago

Hi Andy, New pull request sent. Thanks for finding this. I don't have ready access to a Windows machine, so I sourced one and sussed out the issue.

I think it's fixed in the newest pull request.

I've also expanded the tests for the caching function to check that it doesn't create a directory if caching is FALSE

adamhsparks commented 7 years ago

Oh, btw, the function get_mirca() will automatically plot the resulting MIRCA2000 file by default unless plot = FALSE.

adamhsparks commented 7 years ago

Realised just now that I never closed this after submitting the PR that's been merged.

Closing now.

andysouth commented 7 years ago

Super, thanks for your input Adam. I'll be doing some more on this in a few weeks time, will send you an update then.

On 23 August 2017 at 11:27, Adam H. Sparks notifications@github.com wrote:

Realised just now that I never closed this after submitting the PR that's been merged.

Closing now.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/AndySouth/climcropr/issues/1#issuecomment-324288220, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5tReWIT8gTQLfnpzxOrWpcDfzv2wofks5sa_51gaJpZM4N9KEU .