How to use the meteomatics.api.query_time_series function in meteomatics

To help you get started, we’ve selected a few meteomatics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github meteomatics / python-connector-api / examples / example.py View on Github external
###input station data timeseries
    startdate_station_ts = startdate_grads_ts - dt.timedelta(days=2)
    enddate_station_ts = startdate_grads_ts - dt.timedelta(hours=3)
    interval_station_ts = dt.timedelta(hours=1)
    parameters_station_ts = ['t_2m:C', 'wind_speed_10m:ms', 'precip_1h:mm']
    model_station_ts = 'mix-obs'
    coordinates_station_ts = [(47.43, 9.4), (50.03, 8.52)]  # St. Gallen / Frankfurt/Main
    wmo_stations = ['066810']  # St. Gallen
    metar_stations = ['EDDF']  # Frankfurt/Main
    mch_stations = ['STG']  # MeteoSchweiz Station St. Gallen

    limits = api.query_user_features(username, password)

    print("\ntime series:")
    try:
        df_ts = api.query_time_series(coordinates_ts, startdate_ts, enddate_ts, interval_ts, parameters_ts,
                                      username, password, model, ens_select, interp_select,
                                      cluster_select=cluster_select)
        print (df_ts.head())
    except Exception as e:
        print("Failed, the exception is {}".format(e))

    print("\npng timeseries:")
    try:
        api.query_png_timeseries(prefixpath_png_ts, startdate_png_ts, enddate_png_ts, interval_png_ts, parameter_png_ts,
                                 lat_N, lon_W, lat_S, lon_E, res_lat, res_lon, username, password)
    except Exception as e:
        print("Failed, the exception is {}".format(e))

    if limits['area request option']:
        print("\ngrid:")
        try: