Skip to content

CIMAFoundation/drops2

Repository files navigation

Binder

drops2

dds data access api

Installation

with pip:

python -m pip install --extra-index-url https://test.pypi.org/simple/ drops2
# or
python -m pip install --no-cache-dir -U git+https://github.com/CIMAFoundation/drops2.git
# you can also specify a branch or a tag
python -m pip install --no-cache-dir -U git+https://github.com/CIMAFoundation/[email protected]

Please note that you may need to install pyproj manually from the project git repository.

Usage

The library tries to load the .drops.rc file in the current folder.

Exampe of .drops.rc file:

{
    "dds_url": "http://example.com/dds/rest",
    "user": "admin",
    "password": "password"
}

If you want to programmatically set the credentials for all the calls use:

import drops2
drops2.set_credentials('http://example.com/dds/rest', 'user', 'password')

Otherwise, you can pass the credentials to each call using the auth parameter.:

from drops2 import sensors
    
with DropsCredentials(url, (user, password)) as auth: # use the instance as a context manager
    sensors.get_sensor_classes(auth=auth)           # do something

Example

Simple example of accessing pluviometric sensors data.

from drops2 import sensors

date_from = '201712110000'
date_to = '201712120000'
sensor_class = 'PLUVIOMETRO'
#require the sensor list within the geowindow
sensors_list = sensors.get_sensor_list(sensor_class, geo_win=(6.0, 36.0, 18.6, 47.5))
df_pluvio = sensors.get_sensor_data(sensor_class, sensors_list, 
                                    date_from, date_to, as_pandas=True)

Check out the Binder Jupyter notebook for more examples.

Versioning

We use SemVer for versioning.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

DDS data access library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •