----------------------
script: get_series.php
----------------------

Purpose
-------
Get timeseries from the Matroos series or maps1d database.

Usage
-----
http://matroos.deltares.nl/direct/get_series.php?db=&loc=&source=&unit=&tstart=&tstop=&anal_time=&print_anal=&get_anal=

The part after '?' is meant to define parameters for the script.
Each parameter should be given as <param>=<value>, the different
parameters are separated by the '&' sign.

Examples
--------
http://matroos.deltares.nl/direct/get_series.php?loc=hoekvanholland&source=observed&unit=waterlevel&tstart=202105130000&tstop=202105140000

wget --proxy=off -O output.txt \
'http://matroos.deltares.nl/direct/get_series.php?loc=hoekvanholland&source=observed&unit=waterlevel&tstart=202105130000&tstop=202105140000'

Cut and paste the above URL in the address bar of the browser, or click on the link, to get an example of the output.

Parameters
----------
- db          : The Matroos database to use. Default: series.

- loc         : The location as known by Matroos (see below). Multiple locations
                can be specified by separating them with a semicolon ';'.
                The returned coordinates of a location are longitude and latitude.
                In dd-format (Geo-JSON), a depth coordinate is returned as well;
                this value is always 0, since Matroos does not contain information
                about the depth of locations.

- loc_id      : Optional. The location id may be given instead of a location name.

- source      : The source (or alias thereof) as known by Matroos (see below).

- source_id   : Optional. The source id may be given instead of a source name.

- unit        : A unit as known by Matroos (see below).

- unit_id     : Optional. The unit id may be given instead of a unit name.

- realization : Realization number. This may be a single number, a
                range (two numbers separated by two dots (..)), or a
                list containing single numbers and/or ranges
                (separated by semi-colon (;)), e.g. 0 or 0..10 or
                0;1 or 0;1;5..10. The strings 'all' and '*' (without
                quotes) return all the available realizations.

- tstart      : First time for the timeseries in format YYYYMMDDHHMM.
                Any '-', <space>, or ':' will be ignored, so a format like 
                YYYY-MM-DD HH:MM will be accepted as well.
                Default: latest analysis time.
                In case of observation data and no tstart specified:
                the most recent measurement is returned if this is no more than 3 days old, else no results are found.

- tstop       : Last time for the timeseries in the same format as tstart.
                Default: tstart plus 50 days.

- tinc        : Time increment in minutes. If given, alle timesteps will
                be output with missing values filled in.
                Time-interpolation will be done when interp_time=1. Default: empty.

- interp_time : Optional. Interpolate in time when interp_time=1.
                No extrapolation is done at the beginning or end of the series.
                Default: no time interpolation.

- timezone    : MET, GMT or GMT[+/-][hours] default GMT.

- anal_time   : Analysis time, default 'most recent'. If given, analyses
                after this time will be ignored.

- last_anal   : If last_anal=1, only returns data of the latest
                analysis at or before anal_time.

- single_anal : If single_anal=1, only returns data for one analysis,
                i.e. the result is not a combination of multiple analyses.
                Default: 0

- fc_min      : Minimum forecast lead time in minutes; default no minimum.

- fc_max      : Maximum forecast lead time in minutes; default no maximum.

- print_anal  : Add an extra column in the output containing the analysis
                time of that value (anal_time=Y or anal_time=1).
                Default: when anal_time=0 or anal_time='' analyse time is not printed.

- get_anal    : If Y(es) or 1, only the available analyse times between
                tstart and tstop are given.

- all_anal    : If Y(es) or 1, all the available analyse times between
                tstart and tstop are given.
                (w.r.t. fc_min and fc_max if given)

- list        : If Y(es) or 1, just print available locations, sources
                and units combinations.

- zip         : Optional. If given and not '0', the NetCDF-file (in case format='netcdf')
                will be zipped before the download starts.

- id          : Optional. An ID of the time series may be given instead of a location, source and unit combination.

- format      : Output format 'text' or 'xml' or 'netcdf' or 'dd_2.0.0' (for Digital Delta JSON);
                'dd' without a version number redirects to the most recent version of Digital Delta.
                Default: 'text'.

- includeMetaData : Optional. Flag that specifies whether to write meta
                data (true) or not (false) in Digital Delta output (format=dd).
                Default: true.

- responseLocation : Optional. Rename certain location response parameters for Digital Delta output (format=dd).
                Arguments should look like: <original_attribute>:eq:<custom_response>;
                multiple attributes can be replaced by adding more of these arguments separated by a semi-colon (;).

- responseObservationType : see 'responseLocation', but for unit parameters.

- process     : Optional. If format=dd, the results are filtered for the given process. Process can be one of:
                'measurement', 'astronomical', or 'forecast'.
                Default: measurement.

Remark: If either loc, source or unit is left empty, a list with
        available locations, sources and/or units will be presented
        at the bottom of this help page. E.g. just fill in
        'unit=wind_direction' and see the result below.
        If either loc, source or unit has the value 'all', a page
        is presented giving only the available locations, sources
        and units.

Available locations, sources and units (series database):
---------------------------------------------------------
Locations:
----------
amerongen beneden
amerongen boven
arnhem
belfeld beneden
belfeld boven
borgharen dorp
borgharen julianakanaal
cherbourg
culemborg brug
de steeg haven
deventer
dodewaard
doesburg brug
driel beneden
driel boven
eijsden grens
elsloo
gennep
grave beneden
grave boven
grebbe
grevenbicht
hagestein
hagestein beneden
heel beneden
heel boven
heesbeen
ijsselkop
kampen
katerveer
keizersveer
kessel
keteldiep
krimpen a/d lek
linne beneden
lith boven
lith dorp
lobith
maaseik
megen
mook
neer
nijmegen
olst
pannerdensche kop
roermond
sambeek beneden
sambeek boven
schoonhoven
sint pieter
stevensweert
tiel
venlo
vuren
well
werkendam buiten
wijhe
zaltbommel
zutphen

Sources:
--------
fews_rivieren
observed

Units:
------
discharge
water_temperature
waterlevel