Giter VIP home page Giter VIP logo

Comments (20)

adamhsparks avatar adamhsparks commented on May 26, 2024 1

You have three options, i) wait for me to have time to complete the rewriting of the nasapower package to work with the new POWER API, ii) access the data directly through the POWER website and download it in your browser or iii) write your own API calls to access the data in R.

I'm doing this in my own personal time and am working on it as fast as I possibly can. This is not a funded or work project in any way. I spent several hours yesterday already working on it and made good progress. I hope to have a beta version shortly.

from nasapower.

LucasJorgeAbdala avatar LucasJorgeAbdala commented on May 26, 2024 1

I have just try it, and it is working perfectly. So far, i did not find any bugs. Will let you know if something appears. Thanks for your effort adam! This is a great package.

from nasapower.

olicoste avatar olicoste commented on May 26, 2024

Hi,

Now that it has migrated to the new API, how can I amend my R code to make it work?

from nasapower.

adamhsparks avatar adamhsparks commented on May 26, 2024

It hasn't been migrated to the new API yet. I've not had time to finish this work and release v4.0.0 yet, sorry.

from nasapower.

olicoste avatar olicoste commented on May 26, 2024

Hi, Ok, thanks for the fast answer.
I thought this was why I got an Error 422 when requesting data with get_power function. Do you know where this could come from?

from nasapower.

fe-neculqueo avatar fe-neculqueo commented on May 26, 2024

I got an Error 442 too. What I should do?

from nasapower.

LucasJorgeAbdala avatar LucasJorgeAbdala commented on May 26, 2024

I have been receiving the same mistake. I hope it is something easy to fix adam!! This is great work.

Thanks!!

from nasapower.

adamhsparks avatar adamhsparks commented on May 26, 2024

Not as easy as a fix as I'd like. I'm rewriting a fair portion of the package's code, but I've made more good progress this AM. I've managed to send a query and parse it using the new code. I'll hope to have something you can try soon.

from nasapower.

adamhsparks avatar adamhsparks commented on May 26, 2024

I've a working beta version! This is a work in progress, so there are new functions that DO NOT YET WORK! But you should be able to start converting old scripts to use the new POWER API V2 functionality now for point data.

If you need access or want to try and would like to give feedback, e.g. report bugs, then here are the instructions.

Install the development version from GitHub that I've been working on.

if (!require("remotes")) {
  install.packages("remotes")
}

remotes::install_github("ropensci/nasapower",
                         ref = "devel"
)

Then fetch POINT data for the daily API endpoint.

library("nasapower")
daily_ag <- get_power(community = "ag",
                      lonlat = c(151.81, -27.48),
                      pars = c("RH2M", "T2M", "PRECTOTCORR"),
                      dates = "1985-01-01",
                      temporal_api = "daily"
                      )
daily_ag

Note that I have made changes to the functions to correspond to changes in the API. The get_power() now requests temporal_api rather than temporal_average and the precipitation (for those of you using rainfall) is now "PRECTOTCORR" rather than "PRECTOT". I've not made any other user-facing changes yet aside from adding new arguments to get_power() for wind. These new parameters for wind have not yet been tested but are documented in the get_power() help file.

Please try it out and let me know what you may find. Currently, as far as I know, the POWER team has only enabled POINT data so you should get an error if you request something out of scope, but for example, this works (for me).

Happy downloading!

from nasapower.

xianranli avatar xianranli commented on May 26, 2024

Great work Adam! One issue I encountered is the server would only allow 5 queries, which would break the loop for many requests. The solution I currently used is to put Sys.sleep(10) in the loop, which continues but slow down the process.

from nasapower.

adamhsparks avatar adamhsparks commented on May 26, 2024

Thanks, I've not yet tested this but will do some checking of the POWER documentation and adjust the nasapower documentation and functionality accordingly.

from nasapower.

adamhsparks avatar adamhsparks commented on May 26, 2024

I've reached the point where I've merged the new feature branch into devel now and updated the installation instructions.

I think all the major functionality is now in place with tests and the vignette also completed. The last bit left is to check any rate-limiting. I know the POWER team has some documentation about not hitting the server too hard, I've written the client to make only one query per point as they've requested, but have no other built-in rate limits as yet.

from nasapower.

olicoste avatar olicoste commented on May 26, 2024

It works for me too, that is an awsome job. Thank you for taking some of your personal time to fix that. So far no problem for me but for sure I'll let know if something pops up.

from nasapower.

adamhsparks avatar adamhsparks commented on May 26, 2024

v4.0.0 has been submitted to CRAN. Just awaiting them to action the approval.

from nasapower.

jizarten avatar jizarten commented on May 26, 2024

Hi Adam,

  1. I've tried to retrieve daily precipitation (i.e., PRECTOTCORR) data for Ugandan districts for several years (i.e., 2000 to 2020) both through the API and the web data access viewer but I always get -999 as a value for all the observations. Any idea why this is happening?
  2. I also wonder if it's possible to retrieve averaged data for polygons using a shapefile. If there is grid/raster data available for a continent/country for ag data (e.g., precipitation, temperature, radiation), I can do the averaged extraction myself but I'm not sure if this is something that can be done.

Thank you.
Best,
Jorge

from nasapower.

adamhsparks avatar adamhsparks commented on May 26, 2024

Hi Jorge,
This issue is closed. Please open a new one for new issues like these.

  1. Please see the POWER website for their statement regarding the precipitation being corrupted.
  2. No. This is only an API client. I don’t do any manipulation other than reformatting and replacing NA values with NA.

from nasapower.

LucasJorgeAbdala avatar LucasJorgeAbdala commented on May 26, 2024

I am having the same problem with the -999 for precipitation. But is working very good everything!

from nasapower.

adamhsparks avatar adamhsparks commented on May 26, 2024

Yes, the -999 for precipitation is a known-bug. I've fixed it in the devel branch. The next release will not report -999 for invalid values and hopefully by then the precipitation is fixed in the POWER data.

from nasapower.

andresouzaesilva avatar andresouzaesilva commented on May 26, 2024

I'm getting the 422 error, but my code is in Python, then the code shows 429, is there any Python update ready already? Thank´s

from nasapower.

adamhsparks avatar adamhsparks commented on May 26, 2024

If you’re getting a 422 error with nasapower, this R package, then you need to update your installed version to use the new version of the POWER API. Otherwise, I’m not able to provide you with assistance for any other programming languages.

from nasapower.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.