Split a large CIMIS query into multiple smaller queries based on a time interval.

cimis_split_query(targets, start.date, end.date, items, max.records = 1750L)

Arguments

targets

geographies or weather stations of interest. This parameter may specify one or many stations, zip codes, coordinates, or street addresses; however, you are not allowed to mix values from different categories. This means the targets parameter must contain only stations, only zip codes, only coordinates, or only street addresses. You will receive an error if you attempt to mix different category types. The formats are accepted:

  • A comma delimited list of WSN station numbers

  • A comma delimited list of California zip codes

  • A semicolon delimited list of decimal - degree coordinates

  • A semicolon delimited list of street addresses

start.date

Specifies the start date. The data format is "yyyy-mm-dd".

end.date

Specifies the end date. The data format is "yyyy-mm-dd".

items

specifies one or more comma-delimited data elements to include in your response. See data_items() for a complete list of possible data element values. Default: day-asce-eto, day-precip, day-sol-rad-avg, day-vap-pres-avg, day-air-tmp-max, day-air-tmp-min, day-air-tmp-avg, day-rel-hum-max, day-rel-hum-min, day-rel-hum-avg, day-dew-pnt, day-wind-spd-avg, day-wind-run, day-soil-tmp-avg.

max.records

The maximum number of records returned by a query. The default value is the the maximum data limit allowed by the CIMIS Web API (1,750 records).

Value

A data frame with columns "targets", "start.date", "end.date", and "items".

Details

Queries are not split by targets or items, i.e. each resulting query will include all targets and items.

Examples

cimis_split_query(170, "2000-01-01", "2010-12-31", "day-air-tmp-avg")
#> # A tibble: 3 × 4
#>   start.date end.date   items     targets  
#>   <date>     <date>     <list>    <list>   
#> 1 2000-01-01 2003-08-31 <chr [1]> <dbl [1]>
#> 2 2003-09-01 2007-05-01 <chr [1]> <dbl [1]>
#> 3 2007-05-02 2010-12-31 <chr [1]> <dbl [1]>
cimis_split_query(c(149, 170), "2018-01-01", "2018-12-31",
  c("day-air-tmp-avg", "hly-air-tmp", "hly-rel-hum"))
#> # A tibble: 21 × 4
#>    start.date end.date   items     targets  
#>    <date>     <date>     <list>    <list>   
#>  1 2018-01-01 2018-12-31 <chr [1]> <dbl [2]>
#>  2 2018-01-01 2018-01-18 <chr [2]> <dbl [2]>
#>  3 2018-01-19 2018-02-05 <chr [2]> <dbl [2]>
#>  4 2018-02-06 2018-02-23 <chr [2]> <dbl [2]>
#>  5 2018-02-24 2018-03-13 <chr [2]> <dbl [2]>
#>  6 2018-03-14 2018-04-01 <chr [2]> <dbl [2]>
#>  7 2018-04-02 2018-04-19 <chr [2]> <dbl [2]>
#>  8 2018-04-20 2018-05-07 <chr [2]> <dbl [2]>
#>  9 2018-05-08 2018-05-25 <chr [2]> <dbl [2]>
#> 10 2018-05-26 2018-06-12 <chr [2]> <dbl [2]>
#> # ℹ 11 more rows