climateservAccess
About
A python package to access data through ClimateSERV API. Built as a more complete, customized version of the existing climateserv package by SERVIR, which did not support all datatypes.
Documentation
datatypeDict
Stores a dictionary with all datatype numbers and names (see Reference)
getDataFrame
Accesses requested data through ClimateSERV API and returns it in a pandas dataframe (see Example Code). Returns None if no data found.
Parameters
- data_type (int): Datatype number
- start_date (str): Start date in MM/DD/YYYY format
- end_date (str): End date in MM/DD/YYYY format
- operation_type (string): 'Average', 'Min', or 'Max'
- geometry_coords (list): List of coordinates for polygon
getCSV
Accesses requested data through ClimateSERV API and saves it to a csv file.
Parameters
- data_type (int): Datatype number
- start_date (str): Start date in MM/DD/YYYY format
- end_date (str): End date in MM/DD/YYYY format
- operation_type (string): 'Average', 'Min', or 'Max'
- geometry_coords (list): List of coordinates for polygon
- filename (str): Name of the CSV file to be saved
getBox
Returns a list with coordinates for a square centered at (lon, lat), with width res
Parameters
- lat (float): Latitude.
- lon (float): Longitude.
- res (float): Resolution.
Example Code
This code snippet retrieves Stonehenge precipitation data from ClimateSERV (NASA_IMERG_Late), stores it in a pandas dataframe, and plots the data for the month of January 2023.
import pandas as pd
import matplotlib.pyplot as plt
import climateservaccess as ca
# Define parameters
data_type = 26 # see ca.datatypeDict for data types
start_date = '01/01/2023'
end_date = '01/30/2023'
operation_type = 'average' # valid options are: 'average', 'max', 'min'
lat = 51.17912455395276 # latitude of Stonehenge
lon = -1.8262705029300066 # longitude of Stonehenge
res = 0.01 # resolution in degrees
polygon = ca.getBox(lat, lon, res) # defines box of width res around lat, lon
# Get dataframe with data from ClimateSERV
df = ca.getDataFrame(data_type, start_date, end_date, operation_type, polygon)
# Select data from df and store inside data_df
data_df = pd.DataFrame(df['data'].to_list())
# Convert the date column to datetime format
data_df['date'] = pd.to_datetime(data_df['date'])
# Plot the data
plt.figure(figsize=(10,5))
plt.plot(data_df['date'], data_df['raw_value'])
plt.xlabel('Date')
plt.ylabel('Precipitation (mm)')
plt.title('Average Daily Precipitation of Stonehenge')
plt.show()
Reference
List of datatypes also available under ClimateSERV Developers API.
Historical Datasets
| Datatype Number | Datatype | Data Availability | Date Range |
|---|---|---|---|
| 0 | CHIRPS_Rainfall | Every 1 day | 1981 - Near Present |
| 1 | eMODIS_NDVI_W_Africa | Every 10 days | 2002 - September 2022 |
| 2 | eMODIS_NDVI_E_Africa | Every 10 days | 2002 - September 2022 |
| 5 | eMODIS_NDVI_S_Africa | Every 10 days | 2002 - September 2022 |
| 26 | NASA_IMERG_Late | Every 1 day | 2000 - Near Present |
| 28 | eMODIS_NDVI_Central_Asia | Every 10 days | 2002 - September 2022 |
| 29 | ESI_4WEEK | Every 7 days | 2000 - Present |
| 31 | CHIRPS_GEFS_Forecast_Mean_Anom | Every 1 day | 1985 - Near Present |
| 32 | CHIRPS_GEFS_Forecast_Mean_Precip | Every 1 day | 1985 - Near Present |
| 33 | ESI_12WEEK | Every 7 days | 2000 - Present |
| 37 | USDA_SMAP_Soil_Moisture_Profile | Every 3 days | March 2015 - August 2022 |
| 38 | USDA_SMAP_Surface_Soil_Moisture | Every 3 days | March 2015 - August 2022 |
| 39 | USDA_SMAP_Surface_Soil_Moisture_Anom | Every 3 days | March 2015 - August 2022 |
| 40 | USDA_SMAP_Sub_Surface_Soil_Moisture | Every 3 days | March 2015 - August 2022 |
| 41 | USDA_SMAP_Sub_Surface_Soil_Moisture_Anom | Every 3 days | March 2015 - August 2022 |
| 90 | UCSB_CHIRP_Rainfall | Every 1 day | 1981 - Near Present |
| 91 | NASA_IMERG_Early | Every 1 day | 2000 - Near Present |
| 541 | NSIDC_SMAP_Sentinel_1Km | Every 1 day | 2015 - Near Present |
| 542 | NSIDC_SMAP_Sentinel_1Km_15_day | Every 15 days | 2015 - Near Present |
| 661 | LIS_ET | Every 1 day | 2000 - Near Present |
| 662 | LIS_Baseflow | Every 1 day | 2000 - Near Present |
| 663 | LIS_Runoff | Every 1 day | 2000 - Near Present |
| 664 | LIS_Soil_Moisture_0_10cm | Every 1 day | 2000 - Near Present |
| 665 | LIS_Soil_Moisture_10_40cm | Every 1 day | 2000 - Near Present |
| 666 | LIS_Soil_Moisture_40_100cm | Every 1 day | 2000 - Near Present |
| 667 | LIS_Soil_Moisture_100_200cm | Every 1 day | 2000 - Near Present |
Forecast Datasets
These NMME (North American Multi-Model Ensemble) datasets all provide daily forecasts up to 6 months out.
| Datatype Number | Datatype |
|---|---|
| 6 | CCSM_Ensemble_1_Temperature |
| 7 | CCSM_Ensemble_1_Precipitation |
| 8 | CCSM_Ensemble_2_Temperature |
| 9 | CCSM_Ensemble_2_Precipitation |
| 10 | CCSM_Ensemble_3_Temperature |
| 11 | CCSM_Ensemble_3_Precipitation |
| 12 | CCSM_Ensemble_4_Temperature |
| 13 | CCSM_Ensemble_4_Precipitation |
| 14 | CCSM_Ensemble_5_Temperature |
| 15 | CCSM_Ensemble_5_Precipitation |
| 16 | CCSM_Ensemble_6_Temperature |
| 17 | CCSM_Ensemble_6_Precipitation |
| 18 | CCSM_Ensemble_7_Temperature |
| 19 | CCSM_Ensemble_7_Precipitation |
| 20 | CCSM_Ensemble_8_Temperature |
| 21 | CCSM_Ensemble_8_Precipitation |
| 22 | CCSM_Ensemble_9_Temperature |
| 23 | CCSM_Ensemble_9_Precipitation |
| 24 | CCSM_Ensemble_10_Temperature |
| 25 | CCSM_Ensemble_10_Precipitation |
| 42 | CFSv2_Ensemble_1_Temperature |
| 43 | CFSv2_Ensemble_1_Precipitation |
| 44 | CFSv2_Ensemble_2_Temperature |
| 45 | CFSv2_Ensemble_2_Precipitation |
| 46 | CFSv2_Ensemble_3_Temperature |
| 47 | CFSv2_Ensemble_3_Precipitation |
| 48 | CFSv2_Ensemble_4_Temperature |
| 49 | CFSv2_Ensemble_4_Precipitation |
| 50 | CFSv2_Ensemble_5_Temperature |
| 51 | CFSv2_Ensemble_5_Precipitation |
| 52 | CFSv2_Ensemble_6_Temperature |
| 53 | CFSv2_Ensemble_6_Precipitation |
| 54 | CFSv2_Ensemble_7_Temperature |
| 55 | CFSv2_Ensemble_7_Precipitation |
| 56 | CFSv2_Ensemble_8_Temperature |
| 57 | CFSv2_Ensemble_8_Precipitation |
| 58 | CFSv2_Ensemble_9_Temperature |
| 59 | CFSv2_Ensemble_9_Precipitation |
| 60 | CFSv2_Ensemble_10_Temperature |
| 61 | CFSv2_Ensemble_10_Precipitation |
| 62 | CFSv2_Ensemble_11_Temperature |
| 63 | CFSv2_Ensemble_11_Precipitation |
| 64 | CFSv2_Ensemble_12_Temperature |
| 65 | CFSv2_Ensemble_12_Precipitation |
| 66 | CFSv2_Ensemble_13_Temperature |
| 67 | CFSv2_Ensemble_13_Precipitation |
| 68 | CFSv2_Ensemble_14_Temperature |
| 69 | CFSv2_Ensemble_14_Precipitation |
| 70 | CFSv2_Ensemble_15_Temperature |
| 71 | CFSv2_Ensemble_15_Precipitation |
| 72 | CFSv2_Ensemble_16_Temperature |
| 73 | CFSv2_Ensemble_16_Precipitation |
| 74 | CFSv2_Ensemble_17_Temperature |
| 75 | CFSv2_Ensemble_17_Precipitation |
| 76 | CFSv2_Ensemble_18_Temperature |
| 77 | CFSv2_Ensemble_18_Precipitation |
| 78 | CFSv2_Ensemble_19_Temperature |
| 79 | CFSv2_Ensemble_19_Precipitation |
| 80 | CFSv2_Ensemble_20_Temperature |
| 81 | CFSv2_Ensemble_20_Precipitation |
| 82 | CFSv2_Ensemble_21_Temperature |
| 83 | CFSv2_Ensemble_21_Precipitation |
| 84 | CFSv2_Ensemble_22_Temperature |
| 85 | CFSv2_Ensemble_22_Precipitation |
| 86 | CFSv2_Ensemble_23_Temperature |
| 87 | CFSv2_Ensemble_23_Precipitation |
| 88 | CFSv2_Ensemble_24_Temperature |
| 89 | CFSv2_Ensemble_24_Precipitation |
License
Distributed under the MIT License. See LICENSE.txt for more information.
Metadata
Release files for climateservaccess 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| climateservaccess-1.0.4.tar.gz | 6.9 kB | Without provenance | Details for climateservaccess-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| climateservaccess-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for climateservaccess-1.0.4-py3-none-any.whl |
Total release size: 13.9 kB
Release files / climateservaccess-1.0.4.tar.gz
| Download URL | climateservaccess-1.0.4.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0042a4c4b3921ebe108301a0c6a60ad7c7f0307f8d1c8acc5f0c32822de3ddd8
|
|
BLAKE2b-256 checksum How to use checksums |
9e0cf3d0cffd583f22d14ed260354f6c709e9d4ee0c4ceddf72a6d238bce2011
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / climateservaccess-1.0.4-py3-none-any.whl
| Download URL | climateservaccess-1.0.4-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fbd9b322ebf4cea15d588b8801b811f8898e82d14fc7eb75598cf44a82ff3578
|
|
BLAKE2b-256 checksum How to use checksums |
4fb8df51aa48e36166d62a705f9cc5fd421176c9bdeefc7707cb4c271cb70312
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Security for climateservaccess 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.