import os
from pathlib import Path
from opencdms import MidasOpen
connection = os.path.join(
Path.home(), 'work', 'opencdms-dev', 'git', 'opencdms-test-data')
session = MidasOpen(connection)
filters = {
'src_id': 838,
'period': 'hourly',
'year': 1991,
'elements': ['wind_speed', 'wind_direction'],
}
obs = session.obs(**filters)
obs
ob_time | src_id | wind_direction | wind_speed | |
---|---|---|---|---|
0 | 1991-01-01 00:00:00 | 838 | 230.0 | 3.0 |
1 | 1991-01-01 01:00:00 | 838 | 230.0 | 3.0 |
2 | 1991-01-01 02:00:00 | 838 | 210.0 | 4.0 |
3 | 1991-01-01 03:00:00 | 838 | 200.0 | 2.0 |
4 | 1991-01-01 04:00:00 | 838 | 220.0 | 1.0 |
... | ... | ... | ... | ... |
16212 | 1991-12-31 19:00:00 | 838 | 190.0 | 1.0 |
16213 | 1991-12-31 20:00:00 | 838 | 220.0 | 2.0 |
16214 | 1991-12-31 21:00:00 | 838 | 210.0 | 3.0 |
16215 | 1991-12-31 22:00:00 | 838 | 200.0 | 4.0 |
16216 | 1991-12-31 23:00:00 | 838 | 220.0 | 5.0 |
16217 rows Γ 4 columns
type(obs)
pandas.core.frame.DataFrame
from opencdms.process.climatol import windrose
windrose(obs)
Postgres | MySQL | Oracle | File-based | |
---|---|---|---|---|
CliDE | β | |||
Climsoft | β | |||
MCH | β | |||
Midas Open | β |
In this demo we'll install PostgreSQL by using the Timescale docker image that includes PostgreSQL 12, TimescaleDB (time series) and PostGIS (spatial) extensions.
When the container is running, the database server will be available on port 5432
See: Docker website for instructions on installing docker
You may also want to add the current user to the docker
group so that you don't have to prefix each command with sudo
by using: sudo gpasswd -a $USER docker
docker pull timescale/timescaledb-postgis:latest-pg12
# Note: change `password` below to a suitable password
docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg12
# List running containers
docker ps
docker stop c0eb1c33aad9
# Show stopped containers
docker ps -a
docker start c0eb1c33aad9
docker exec -it c0eb1c33aad9 env
# POSTGRES_PASSWORD=...
# PG_VERSION=12.4
# TIMESCALEDB_VERSION=1.7.4