Skip to main content

A package to download NASA NEX/GDDP-CMIP6 downscaled climate change scenarios

Project description

cmip6d

DOI

This python library downloads downscaled climate change scenarios from NASA NEX-GDDP-CMIP6 (https://ds.nccs.nasa.gov/thredds/catalog/AMES/NEX/GDDP-CMIP6/catalog.html).

Instructions

To use this library install the requirements:

  • wget
  • csv
  • numpy
  • pandas
  • xarray
  • beautifulsoup4

If you are using windows, wget needs to be downloaded and added to your paths If you don't want to get the .csv summary you do not need xarray, but it is highly recommended for post-processing.

Install

pip install cmip6d

Examples

To import the library:

from cmip6d import cmip6d

Define the main variables. Until

out_path = 'test' # Defines your output folder
coords = [-75,-69.5,-17.5,-14] # xmin,xmax,ymin,ymax
models = [] # If empty, downloads everything, if not, downloads specified packages
ssp=['ssp245','ssp585'] # DEFAULT VARIABLE. Target scenarios from the NASA server
variables = ['pr','tasmax','tasmin'] # DEFAULT VARIABLE. Target variables from the NASA server

To create the main Python object:

cc = cmip6d(out_path,coords,models,variables=variables,ssp=ssp)

First, it creates the folder structure based on the MODELS, then it generates a "link.txt" file with the links to be downloaded. The "check_links" argument allows you to not re-create the "link.txt" file if it already exists.

cc.get_links(out_path,check_links=True)

To download the links you need to specify a number of workers "nworker", which speeds up the download. Once completed these step you will have all the netcdf files for your climate change model, these can be loaded with xarray or whatever other method you prefer.

cc.download_links(nworker=4)

If you want to merge the yearly individual ".nc" files into one for each variable use:

cc.merge_files(cont)

Additional steps

If you would like to get 2 ".csv" files with coordinates of the following structure:

ID Latitude Longitude
P_0_0 .... .....
P_0_1 .... .....
... .... .....

and

Date P_0_0 P_0_1 ...
2015-01-01 .... ..... ...
2015-01-02 .... ..... ...
... .... ..... ...

You can use the following function after running "merge_files", where "cont=True" does not process the data if the files already exist. This function returns a dictionary of the climate change models and dates that were not processed because of missing dates in the timeserie from 2015-01-01 to 2100-12-31.

todel = cc.get_csv(cont)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmip6d-1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

cmip6d-1.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file cmip6d-1.1.tar.gz.

File metadata

  • Download URL: cmip6d-1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for cmip6d-1.1.tar.gz
Algorithm Hash digest
SHA256 7b89b5c76e0922877b43f780ceeddd70583b228c3667baab64be14b20daa6552
MD5 75353d7e1d9911983dcbed420b6381b2
BLAKE2b-256 2e8a19704db0e4a1c57c8e338cf2a830e6fe88b8271d23bbb0af5e210f0f6599

See more details on using hashes here.

Provenance

File details

Details for the file cmip6d-1.1-py3-none-any.whl.

File metadata

  • Download URL: cmip6d-1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for cmip6d-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b973e29e7d2a5487a5bebcd67c7924f8fee70713900ec5337bb4dd847488166
MD5 5e309d59ad78b9e75e72851fea1f846a
BLAKE2b-256 f7c2a46d2ffbe80a36b2ceab77ea6926c246eabeb8a19a1ba62542969ac73988

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page