clima-anom


Nameclima-anom JSON
Version 0.7.8 PyPI version JSON
download
home_pagehttps://github.com/mhacarthur/clima-anom
SummaryObtain the climatology and anomalies only for monthly data.
upload_time2023-11-29 21:13:28
maintainer
docs_urlNone
authorCesar Arturo Sanchez Pena
requires_python>=3.5
licenseMIT
keywords climatology anomalies monthly correlation netcdf mae rmse bias create netcdf remove continent remove ocean shapefile remove
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            

<img src="https://img.shields.io/badge/License-MIT-blue?style=for-the-badge" /> <img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/mhacarthur/clima_anom?style=for-the-badge"> <img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/y/mhacarthur/clima_anom?style=for-the-badge"> <img alt="GitHub contributors" src="https://img.shields.io/github/contributors/mhacarthur/clima_anom?style=for-the-badge"> <img alt="PyPI" src="https://img.shields.io/pypi/v/clima-anom?color=red&label=clima-anom&style=for-the-badge"> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/mhacarthur/clima_anom?style=for-the-badge"> <img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/mhacarthur/clima_anom?style=for-the-badge"> <img alt="GitHub top language" src="https://img.shields.io/github/languages/top/mhacarthur/clima_anom?style=for-the-badge">

Climatology and Anomalies in Python
=================================================

Overview
---
This code provides experimental and simples tools for differents operations on climate data, mainly obtaining climatologies and anomalies values, in addition to others operations such as data extraction from continent, ocean or a shapefile.

Pip install
---
```bash
pip install clima_anom
```

Manual installation
---
clone clima\_anom and install in exists or new conda env. 

1. Clone repo and install

  ```bash
  git clone https://github.com/mhacarthur/clima_anom.git
  cd clima_anom
  pip install .
  ```

Dependencies
----
- Python >= 3.5 
- cartopy == 0.18.0
- netcdf4 == 1.5.7
- pyshp == 2.1.3
- Option: Linux

1. How to install dependencies

  ```bash
  # cartopy
  conda install -c conda-forge cartopy
  # netcdf4
  conda install netcdf4
  # pyshp
  pip install pyshp
  ```

Data
----
The data use for examples is in directory data. For complete data see:

[TRMM Precipitation L3 daily 0.25x0.25 V7](https://disc.gsfc.nasa.gov/datasets/TRMM_3B42_Daily_7/summary)

Example
---

### Read  data
```python
import os
import clima_anom as ca

data_dir = '..'+os.sep+'data'+os.sep+'3B42_199901_201212.nc'
data = ca.read_netcdf(data_dir,2)

lat = data['lat']
lon = data['lon']
pre = data['prec']

pre_dictionary = ca.data_dictionary(pre)
```

### Colorbar example 
```python
import clima_anom as ca
import matplotlib.pyplot as plt

cmap = plt.cm.Spectral_r
cmap_midle_white = ca.colorbar_middle_white(cmap,'middle')
```
<div align="center">
  <img src="https://raw.githubusercontent.com/mhacarthur/clima_anom/master/figures/Colorbar_1.png" alt="colorbar1" />
</div>

<div align="center">
  <img src="https://raw.githubusercontent.com/mhacarthur/clima_anom/master/figures/Colorbar_2.png" alt="colorbar2" />
</div>

### Remove ocean or continent
```python
import numpy as np
import clima_anom as ca

data_dir = '..'+os.sep+'data'+os.sep+'3B42_199901_201212_climatology.nc'
data = ca.read_netcdf(data_dir,2)
lat = data['lat']
lon = data['lon']
pre = data['pre']

pre_continent = ca.remove_continent_ocean(pre,lat,lon,'continent')
pre_ocen = ca.remove_continent_ocean(pre,lat,lon,'ocean')
```
<div align="center">
  <img src="https://raw.githubusercontent.com/mhacarthur/clima_anom/master/figures/Wind_remove_continent_ocean.png" alt="Wind remove mask" />
</div>

### Extract data using shapefile
```python
import clima_anom as ca
import cartopy.io.shapereader as shpreader

file_shape = '..'+os.sep+'shapefile'+os.sep+''+os.sep+'Amazonas.shp'
amazonas = list(shpreader.Reader(file_shape).geometries())

data_dir = '..'+os.sep+'data'+os.sep+'3B42_199901_201212_climatology.nc'
data = ca.read_netcdf(data_dir,2)
lat = data['lat']
lon = data['lon']
pre = data['pre']

pre_amazonas = ca.extract_shapefile('..'+os.sep+'shapefile'+os.sep+'Amazonas.shp',pre,lat,lon,0)

```
<div align="center">
  <img src="https://raw.githubusercontent.com/mhacarthur/clima_anom/master/figures/Extract_shapefile.png" alt="Shapefile" />
</div>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mhacarthur/clima-anom",
    "name": "clima-anom",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "climatology,anomalies,monthly,correlation,netcdf,MAE,RMSE,BIAS,Create netcdf,remove continent,remove ocean,shapefile remove",
    "author": "Cesar Arturo Sanchez Pena",
    "author_email": "arturo66cta@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7a/25/395464e7d8f9d3a525e6f0763c794f61ebbf7fd0bb8a1700b6a09f2ed9ee/clima_anom-0.7.8.tar.gz",
    "platform": null,
    "description": "\n\n<img src=\"https://img.shields.io/badge/License-MIT-blue?style=for-the-badge\" /> <img alt=\"GitHub last commit\" src=\"https://img.shields.io/github/last-commit/mhacarthur/clima_anom?style=for-the-badge\"> <img alt=\"GitHub commit activity\" src=\"https://img.shields.io/github/commit-activity/y/mhacarthur/clima_anom?style=for-the-badge\"> <img alt=\"GitHub contributors\" src=\"https://img.shields.io/github/contributors/mhacarthur/clima_anom?style=for-the-badge\"> <img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/clima-anom?color=red&label=clima-anom&style=for-the-badge\"> <img alt=\"GitHub pull requests\" src=\"https://img.shields.io/github/issues-pr/mhacarthur/clima_anom?style=for-the-badge\"> <img alt=\"GitHub repo size\" src=\"https://img.shields.io/github/repo-size/mhacarthur/clima_anom?style=for-the-badge\"> <img alt=\"GitHub top language\" src=\"https://img.shields.io/github/languages/top/mhacarthur/clima_anom?style=for-the-badge\">\n\nClimatology and Anomalies in Python\n=================================================\n\nOverview\n---\nThis code provides experimental and simples tools for differents operations on climate data, mainly obtaining climatologies and anomalies values, in addition to others operations such as data extraction from continent, ocean or a shapefile.\n\nPip install\n---\n```bash\npip install clima_anom\n```\n\nManual installation\n---\nclone clima\\_anom and install in exists or new conda env. \n\n1. Clone repo and install\n\n  ```bash\n  git clone https://github.com/mhacarthur/clima_anom.git\n  cd clima_anom\n  pip install .\n  ```\n\nDependencies\n----\n- Python >= 3.5 \n- cartopy == 0.18.0\n- netcdf4 == 1.5.7\n- pyshp == 2.1.3\n- Option: Linux\n\n1. How to install dependencies\n\n  ```bash\n  # cartopy\n  conda install -c conda-forge cartopy\n  # netcdf4\n  conda install netcdf4\n  # pyshp\n  pip install pyshp\n  ```\n\nData\n----\nThe data use for examples is in directory data. For complete data see:\n\n[TRMM Precipitation L3 daily 0.25x0.25 V7](https://disc.gsfc.nasa.gov/datasets/TRMM_3B42_Daily_7/summary)\n\nExample\n---\n\n### Read  data\n```python\nimport os\nimport clima_anom as ca\n\ndata_dir = '..'+os.sep+'data'+os.sep+'3B42_199901_201212.nc'\ndata = ca.read_netcdf(data_dir,2)\n\nlat = data['lat']\nlon = data['lon']\npre = data['prec']\n\npre_dictionary = ca.data_dictionary(pre)\n```\n\n### Colorbar example \n```python\nimport clima_anom as ca\nimport matplotlib.pyplot as plt\n\ncmap = plt.cm.Spectral_r\ncmap_midle_white = ca.colorbar_middle_white(cmap,'middle')\n```\n<div align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/mhacarthur/clima_anom/master/figures/Colorbar_1.png\" alt=\"colorbar1\" />\n</div>\n\n<div align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/mhacarthur/clima_anom/master/figures/Colorbar_2.png\" alt=\"colorbar2\" />\n</div>\n\n### Remove ocean or continent\n```python\nimport numpy as np\nimport clima_anom as ca\n\ndata_dir = '..'+os.sep+'data'+os.sep+'3B42_199901_201212_climatology.nc'\ndata = ca.read_netcdf(data_dir,2)\nlat = data['lat']\nlon = data['lon']\npre = data['pre']\n\npre_continent = ca.remove_continent_ocean(pre,lat,lon,'continent')\npre_ocen = ca.remove_continent_ocean(pre,lat,lon,'ocean')\n```\n<div align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/mhacarthur/clima_anom/master/figures/Wind_remove_continent_ocean.png\" alt=\"Wind remove mask\" />\n</div>\n\n### Extract data using shapefile\n```python\nimport clima_anom as ca\nimport cartopy.io.shapereader as shpreader\n\nfile_shape = '..'+os.sep+'shapefile'+os.sep+''+os.sep+'Amazonas.shp'\namazonas = list(shpreader.Reader(file_shape).geometries())\n\ndata_dir = '..'+os.sep+'data'+os.sep+'3B42_199901_201212_climatology.nc'\ndata = ca.read_netcdf(data_dir,2)\nlat = data['lat']\nlon = data['lon']\npre = data['pre']\n\npre_amazonas = ca.extract_shapefile('..'+os.sep+'shapefile'+os.sep+'Amazonas.shp',pre,lat,lon,0)\n\n```\n<div align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/mhacarthur/clima_anom/master/figures/Extract_shapefile.png\" alt=\"Shapefile\" />\n</div>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Obtain the climatology and anomalies only for monthly data.",
    "version": "0.7.8",
    "project_urls": {
        "Homepage": "https://github.com/mhacarthur/clima-anom"
    },
    "split_keywords": [
        "climatology",
        "anomalies",
        "monthly",
        "correlation",
        "netcdf",
        "mae",
        "rmse",
        "bias",
        "create netcdf",
        "remove continent",
        "remove ocean",
        "shapefile remove"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a25395464e7d8f9d3a525e6f0763c794f61ebbf7fd0bb8a1700b6a09f2ed9ee",
                "md5": "6ccca10d2ed10dd3cf5da640b7cb0f0c",
                "sha256": "73dfefe275f9deff4dac883793f36a829cc5f8b0f2e12c4f730c1a0f07feb856"
            },
            "downloads": -1,
            "filename": "clima_anom-0.7.8.tar.gz",
            "has_sig": false,
            "md5_digest": "6ccca10d2ed10dd3cf5da640b7cb0f0c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 12504,
            "upload_time": "2023-11-29T21:13:28",
            "upload_time_iso_8601": "2023-11-29T21:13:28.279327Z",
            "url": "https://files.pythonhosted.org/packages/7a/25/395464e7d8f9d3a525e6f0763c794f61ebbf7fd0bb8a1700b6a09f2ed9ee/clima_anom-0.7.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-29 21:13:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mhacarthur",
    "github_project": "clima-anom",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "clima-anom"
}
        
Elapsed time: 0.15280s