Giter VIP home page Giter VIP logo

Comments (8)

ldecicco-USGS avatar ldecicco-USGS commented on June 18, 2024

What version are you using? I think the one on CRAN and the one on gitHub (install_github("USGS-R/dataRetrieval") all use the function readNWISqw, which does allow for multiple parameter codes:

siteNumbers <- c('04024430','04024000')
startDate <- '2010-01-01'
endDate <- ''
parameterCd <- c('34247','30234','32104','34220')
rawNWISqwData <- readNWISqw(siteNumbers,parameterCd,startDate,endDate)

So, if you know what pCodes are available from whatNWISdata, you could (I think) get what you are looking for.

Perhaps like this?:

siteNumbers <- c('04024430','04024000')
startDate <- '2010-01-01'
endDate <- ''
availableData <- whatNWISdata(siteNumbers, service = "qw")

pCodes <- unique(availableData$parm_cd[
           which(availableData$parameter_group_nm == "Nutrient")])

rawNWISqwData <- readNWISqw(siteNumbers,pCodes,startDate,endDate)

Let me know if I didn't address your issue...of if you think there's an additional enhancement that i am missing.

from dataretrieval.

tjmills avatar tjmills commented on June 18, 2024

Yes that would work just fine, thanks! However, if you want, I believe you could add in the option to just pull all parms following this URL example:

http://nwis.waterdata.usgs.gov/nwis/qwdata?search_site_no=04024000&search_site_no_match_type=exact&group_key=NONE&sitefile_output_format=html_table&column_name=agency_cd&column_name=site_no&column_name=station_nm&inventory_output=0&rdb_inventory_output=file&TZoutput=0&pm_cd_compare=Greater%20than&radio_parm_cds=all_parm_cds&format=html_table&qw_attributes=0&qw_sample_wide=wide&rdb_qw_attributes=0&date_format=YYYY-MM-DD&rdb_compression=file&list_of_search_criteria=search_site_no

the "radio_parm_cds=all_parm_cds" argument pulls all params

from dataretrieval.

ldecicco-USGS avatar ldecicco-USGS commented on June 18, 2024

I'll look into using this:
http://nwis.waterdata.usgs.gov/usa/nwis/qwdata
more effectively.
I'm grabbing all the other data from waterservices (not waterdata), so I haven't had to pay as much attention to this url generation scheme.

from dataretrieval.

ldecicco-USGS avatar ldecicco-USGS commented on June 18, 2024

@dlorenz-usgs has the same request. Need to bump up priority.

from dataretrieval.

ldecicco-USGS avatar ldecicco-USGS commented on June 18, 2024

I need to submit an update to CRAN (NWISweb slightly changed their server config). I will get the param="all" update in this next release, but not parameter groups...that will be a future release.

from dataretrieval.

ldecicco-USGS avatar ldecicco-USGS commented on June 18, 2024

I added the parameter_group option. Choosing one group seems fine. Choosing more than one, I'm still troubleshooting if it's correct or not. Fewer rows are returned (but the number of parameter codes is greater). I assume that is because choosing the 2 groups means NWIS will return the sites that have both groups (AND instead of OR).

I'll keep troubleshooting, but if anyone just knows the answer, feel free to let me know (@tmills-usgs, @dlorenz-usgs ?).

Here are 3 example urls:
Nutrient:
http://nwis.waterdata.usgs.gov/nwis/qwdata?multiple_site_no=04024430,04024000&sort_key=site_no&group_key=NONE&inventory_output=0&begin_date=2010-01-01&end_date=&TZoutput=0&param_group=NUT&qw_attributes=0&format=rdb&qw_sample_wide=0&rdb_qw_attributes=expanded&date_format=YYYY-MM-DD&rdb_compression=value&list_of_search_criteria=multiple_site_no
(returns 1512 rows)

Organics:
http://nwis.waterdata.usgs.gov/nwis/qwdata?multiple_site_no=04024430,04024000&sort_key=site_no&group_key=NONE&inventory_output=0&begin_date=2010-01-01&end_date=&TZoutput=0&param_group=OPE&qw_attributes=0&format=rdb&qw_sample_wide=0&rdb_qw_attributes=expanded&date_format=YYYY-MM-DD&rdb_compression=value&list_of_search_criteria=multiple_site_no
(returns 585 rows)

Both:
http://nwis.waterdata.usgs.gov/nwis/qwdata?multiple_site_no=04024430,04024000&sort_key=site_no&group_key=NONE&inventory_output=0&begin_date=2010-01-01&end_date=&TZoutput=0&param_group=NUT,OPE&qw_attributes=0&format=rdb&qw_sample_wide=0&rdb_qw_attributes=expanded&date_format=YYYY-MM-DD&rdb_compression=value&list_of_search_criteria=multiple_site_no
(returns 837 rows)

If I try to reproduce with the point and click browser option, I get no results...but I've never been very successful at navigating that site:

http://nwis.waterdata.usgs.gov/nwis/qwdata?multiple_site_no=04024430%2C04024000&param_group=NUT&param_group=OPE&group_key=NONE&sitefile_output_format=html_table&column_name=agency_cd&column_name=site_no&column_name=station_nm&inventory_output=0&rdb_inventory_output=file&begin_date=2013-10-01&end_date=2014-09-30&TZoutput=inUTC&pm_cd_compare=Greater%20than&radio_parm_cds=previous_parm_cds&format=html_table&qw_attributes=expanded&qw_sample_wide=wide&rdb_qw_attributes=0&date_format=YYYY-MM-DD&rdb_compression=value&list_of_search_criteria=multiple_site_no%2Cparam_group

from dataretrieval.

ldecicco-USGS avatar ldecicco-USGS commented on June 18, 2024

OK, this is merged into the main branch. I'm confident that with one parameter group it's working right. I'm confident that dataRetrieval is returning the data correctly with 2 groups...I'm just not 100% sure what that data is.

If anyone knows, or knows who to ask, please let me know.

from dataretrieval.

ldecicco-USGS avatar ldecicco-USGS commented on June 18, 2024

Ah HA!
When you ask for more than one group, you only get sites back that have both (thanks to @eread-usgs ). I will document this, push it, and get it out to CRAN soon. The only lingering question I have is can I over-ride that behavior through the url, so I get all the data back?

from dataretrieval.

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.