{"id":24757872,"url":"https://github.com/opencdms/opencdms-workshop","last_synced_at":"2026-04-16T12:36:31.900Z","repository":{"id":114017164,"uuid":"297289463","full_name":"opencdms/opencdms-workshop","owner":"opencdms","description":"✅🐍 Demo / tutorial for using the opencdms python package","archived":false,"fork":false,"pushed_at":"2024-01-10T12:29:03.000Z","size":110,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-28T15:41:16.732Z","etag":null,"topics":["pandas","python","r"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opencdms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-21T09:20:12.000Z","updated_at":"2023-03-20T16:56:17.000Z","dependencies_parsed_at":"2023-05-22T03:15:27.429Z","dependency_job_id":null,"html_url":"https://github.com/opencdms/opencdms-workshop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencdms%2Fopencdms-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencdms%2Fopencdms-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencdms%2Fopencdms-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencdms%2Fopencdms-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opencdms","download_url":"https://codeload.github.com/opencdms/opencdms-workshop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245078184,"owners_count":20557281,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pandas","python","r"],"created_at":"2025-01-28T15:36:44.896Z","updated_at":"2026-04-16T12:36:31.817Z","avatar_url":"https://github.com/opencdms.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opencdms-workshop\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![License: CC BY-SA 4.0](https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-sa/4.0/)\n\n\u003c!--\n```\n# Install R and header files needed to build Python extensions\nsudo apt install python3-dev r-base\n# curl required for magick library\nsudo apt-get install libcurl4-openssl-dev\n# At the time of writing (Oct 2020), the imagemagick ppa is not\n# available for Unbuntu 20.04\nsudo add-apt-repository -y ppa:cran/imagemagick\nsudo apt-get update\nsudo apt-get install -y libmagick++-dev\n\n# Launch `R` and install `magick`\nR\ninstall.packages(\"magick\")\n\n# In Python, rpy2 is not currently a dependency in pyopencdms becase\n# R must be installed before pip can install rpy2.\n# Therefore install rpy2 (and other dependencies like Jupyter notebook)\ncd ~/work/opencdms-dev/git\ngit clone https://github.com/opencdms/opencdms-demo.git\npip3 install -r ~/work/opencdms-dev/git/opencdms-demo/requirements.txt\n\n# You can run the jupyter notebook server by typing:\njupyter notebook\n\n```\n--\u003e\n### The following section gives an example of a Jupyter notebook session\n\n```python\nimport os\nfrom pathlib import Path\nfrom opencdms import MidasOpen\n```\n\n```python\nconnection = os.path.join(\n    Path.home(), 'work', 'opencdms-dev', 'git', 'opencdms-test-data')\n```\n\n```python\nsession = MidasOpen(connection)\n```\n\n```python\nfilters = {\n    'src_id': 838,\n    'period': 'hourly',\n    'year': 1991,\n    'elements': ['wind_speed', 'wind_direction'],\n}\n```\n\n```python\nobs = session.obs(**filters)\n```\n\n```python\nobs\n\n```\n\n\u003cdiv\u003e\n\n\u003ctable border=\"1\" class=\"dataframe\"\u003e\n  \u003cthead\u003e\n    \u003ctr style=\"text-align: right;\"\u003e\n      \u003cth\u003e\u003c/th\u003e\n      \u003cth\u003eob_time\u003c/th\u003e\n      \u003cth\u003esrc_id\u003c/th\u003e\n      \u003cth\u003ewind_direction\u003c/th\u003e\n      \u003cth\u003ewind_speed\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003cth\u003e0\u003c/th\u003e\n      \u003ctd\u003e1991-01-01 00:00:00\u003c/td\u003e\n      \u003ctd\u003e838\u003c/td\u003e\n      \u003ctd\u003e230.0\u003c/td\u003e\n      \u003ctd\u003e3.0\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e1\u003c/th\u003e\n      \u003ctd\u003e1991-01-01 01:00:00\u003c/td\u003e\n      \u003ctd\u003e838\u003c/td\u003e\n      \u003ctd\u003e230.0\u003c/td\u003e\n      \u003ctd\u003e3.0\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e2\u003c/th\u003e\n      \u003ctd\u003e1991-01-01 02:00:00\u003c/td\u003e\n      \u003ctd\u003e838\u003c/td\u003e\n      \u003ctd\u003e210.0\u003c/td\u003e\n      \u003ctd\u003e4.0\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e3\u003c/th\u003e\n      \u003ctd\u003e1991-01-01 03:00:00\u003c/td\u003e\n      \u003ctd\u003e838\u003c/td\u003e\n      \u003ctd\u003e200.0\u003c/td\u003e\n      \u003ctd\u003e2.0\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e4\u003c/th\u003e\n      \u003ctd\u003e1991-01-01 04:00:00\u003c/td\u003e\n      \u003ctd\u003e838\u003c/td\u003e\n      \u003ctd\u003e220.0\u003c/td\u003e\n      \u003ctd\u003e1.0\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e...\u003c/th\u003e\n      \u003ctd\u003e...\u003c/td\u003e\n      \u003ctd\u003e...\u003c/td\u003e\n      \u003ctd\u003e...\u003c/td\u003e\n      \u003ctd\u003e...\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e16212\u003c/th\u003e\n      \u003ctd\u003e1991-12-31 19:00:00\u003c/td\u003e\n      \u003ctd\u003e838\u003c/td\u003e\n      \u003ctd\u003e190.0\u003c/td\u003e\n      \u003ctd\u003e1.0\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e16213\u003c/th\u003e\n      \u003ctd\u003e1991-12-31 20:00:00\u003c/td\u003e\n      \u003ctd\u003e838\u003c/td\u003e\n      \u003ctd\u003e220.0\u003c/td\u003e\n      \u003ctd\u003e2.0\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e16214\u003c/th\u003e\n      \u003ctd\u003e1991-12-31 21:00:00\u003c/td\u003e\n      \u003ctd\u003e838\u003c/td\u003e\n      \u003ctd\u003e210.0\u003c/td\u003e\n      \u003ctd\u003e3.0\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e16215\u003c/th\u003e\n      \u003ctd\u003e1991-12-31 22:00:00\u003c/td\u003e\n      \u003ctd\u003e838\u003c/td\u003e\n      \u003ctd\u003e200.0\u003c/td\u003e\n      \u003ctd\u003e4.0\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e16216\u003c/th\u003e\n      \u003ctd\u003e1991-12-31 23:00:00\u003c/td\u003e\n      \u003ctd\u003e838\u003c/td\u003e\n      \u003ctd\u003e220.0\u003c/td\u003e\n      \u003ctd\u003e5.0\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003e16217 rows × 4 columns\u003c/p\u003e\n\u003c/div\u003e\n\n```python\ntype(obs)\n\n```\n\u003e    pandas.core.frame.DataFrame\n\n```python\nfrom opencdms.process.climatol import windrose\n```\n\n```python\nwindrose(obs)\n```\n\n### Setting up database servers\n\n|            | Postgres | MySQL | Oracle | File-based |\n|------------|:--------:|:-----:|:------:|:----------:|\n| CliDE      | :white_check_mark: ||     |            |\n| Climsoft   |          | :white_check_mark: ||       |\n| MCH        |          | :white_check_mark: ||       |\n| Midas Open |          |       |        | :white_check_mark: |\n\n#### Installing PostgreSQL\n\nIn this demo we'll install PostgreSQL by using the [Timescale docker image](https://docs.timescale.com/latest/getting-started/installation/docker/installation-docker) that includes PostgreSQL 12, TimescaleDB (time series) and PostGIS (spatial) extensions.\n\nWhen the container is running, the database server will be available on port `5432`\n\nSee: Docker website for instructions on [installing docker](https://docs.docker.com/engine/install/ubuntu/)\nYou 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`\n\n```\ndocker pull timescale/timescaledb-postgis:latest-pg12\n# Note: change `password` below to a suitable password\ndocker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg12\n# List running containers\ndocker ps\n\ndocker stop c0eb1c33aad9\n# Show stopped containers\ndocker ps -a\ndocker start c0eb1c33aad9\ndocker exec -it c0eb1c33aad9 env\n  #    POSTGRES_PASSWORD=...\n  #    PG_VERSION=12.4\n  #    TIMESCALEDB_VERSION=1.7.4\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencdms%2Fopencdms-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopencdms%2Fopencdms-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencdms%2Fopencdms-workshop/lists"}