Package: climateservaccess
climateservAccessAboutA python package to access data throughClimateSERV API. Built as a more complete, customized version of the existingclimateservpackage by SERVIR, which did not support all datatypes.DocumentationdatatypeDictStores a dictionary with all datatype numbers and names(seeReference)getDataFrameAccesses requested data through ClimateSERV API and returns it in a pandas dataframe(seeExample Code). Returns None if no data found.Parametersdata_type(int): Datatype numberstart_date(str): Start date in MM/DD/YYYY formatend_date(str): End date in MM/DD/YYYY formatoperation_type(string): 'Average', 'Min', or 'Max'geometry_coords(list): List of coordinates for polygongetCSVAccesses requested data through ClimateSERV API and saves it to a csv file.Parametersdata_type(int): Datatype numberstart_date(str): Start date in MM/DD/YYYY formatend_date(str): End date in MM/DD/YYYY formatoperation_type(string): 'Average', 'Min', or 'Max'geometry_coords(list): List of coordinates for polygonfilename(str): Name of the CSV file to be savedgetBoxReturns a list with coordinates for a square centered at (lon,lat), with widthresParameterslat(float): Latitude.lon(float): Longitude.res(float): Resolution.Example CodeThis 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()ReferenceList of datatypes also available underClimateSERV Developers API.Historical DatasetsDatatype NumberDatatypeData AvailabilityDate Range0CHIRPS_RainfallEvery 1 day1981 - Near Present1eMODIS_NDVI_W_AfricaEvery 10 days2002 - September 20222eMODIS_NDVI_E_AfricaEvery 10 days2002 - September 20225eMODIS_NDVI_S_AfricaEvery 10 days2002 - September 202226NASA_IMERG_LateEvery 1 day2000 - Near Present28eMODIS_NDVI_Central_AsiaEvery 10 days2002 - September 202229ESI_4WEEKEvery 7 days2000 - Present31CHIRPS_GEFS_Forecast_Mean_AnomEvery 1 day1985 - Near Present32CHIRPS_GEFS_Forecast_Mean_PrecipEvery 1 day1985 - Near Present33ESI_12WEEKEvery 7 days2000 - Present37USDA_SMAP_Soil_Moisture_ProfileEvery 3 daysMarch 2015 - August 202238USDA_SMAP_Surface_Soil_MoistureEvery 3 daysMarch 2015 - August 202239USDA_SMAP_Surface_Soil_Moisture_AnomEvery 3 daysMarch 2015 - August 202240USDA_SMAP_Sub_Surface_Soil_MoistureEvery 3 daysMarch 2015 - August 202241USDA_SMAP_Sub_Surface_Soil_Moisture_AnomEvery 3 daysMarch 2015 - August 202290UCSB_CHIRP_RainfallEvery 1 day1981 - Near Present91NASA_IMERG_EarlyEvery 1 day2000 - Near Present541NSIDC_SMAP_Sentinel_1KmEvery 1 day2015 - Near Present542NSIDC_SMAP_Sentinel_1Km_15_dayEvery 15 days2015 - Near Present661LIS_ETEvery 1 day2000 - Near Present662LIS_BaseflowEvery 1 day2000 - Near Present663LIS_RunoffEvery 1 day2000 - Near Present664LIS_Soil_Moisture_0_10cmEvery 1 day2000 - Near Present665LIS_Soil_Moisture_10_40cmEvery 1 day2000 - Near Present666LIS_Soil_Moisture_40_100cmEvery 1 day2000 - Near Present667LIS_Soil_Moisture_100_200cmEvery 1 day2000 - Near PresentForecast DatasetsThese NMME(North American Multi-Model Ensemble)datasets all provide daily forecasts up to 6 months out.Datatype NumberDatatype6CCSM_Ensemble_1_Temperature7CCSM_Ensemble_1_Precipitation8CCSM_Ensemble_2_Temperature9CCSM_Ensemble_2_Precipitation10CCSM_Ensemble_3_Temperature11CCSM_Ensemble_3_Precipitation12CCSM_Ensemble_4_Temperature13CCSM_Ensemble_4_Precipitation14CCSM_Ensemble_5_Temperature15CCSM_Ensemble_5_Precipitation16CCSM_Ensemble_6_Temperature17CCSM_Ensemble_6_Precipitation18CCSM_Ensemble_7_Temperature19CCSM_Ensemble_7_Precipitation20CCSM_Ensemble_8_Temperature21CCSM_Ensemble_8_Precipitation22CCSM_Ensemble_9_Temperature23CCSM_Ensemble_9_Precipitation24CCSM_Ensemble_10_Temperature25CCSM_Ensemble_10_Precipitation42CFSv2_Ensemble_1_Temperature43CFSv2_Ensemble_1_Precipitation44CFSv2_Ensemble_2_Temperature45CFSv2_Ensemble_2_Precipitation46CFSv2_Ensemble_3_Temperature47CFSv2_Ensemble_3_Precipitation48CFSv2_Ensemble_4_Temperature49CFSv2_Ensemble_4_Precipitation50CFSv2_Ensemble_5_Temperature51CFSv2_Ensemble_5_Precipitation52CFSv2_Ensemble_6_Temperature53CFSv2_Ensemble_6_Precipitation54CFSv2_Ensemble_7_Temperature55CFSv2_Ensemble_7_Precipitation56CFSv2_Ensemble_8_Temperature57CFSv2_Ensemble_8_Precipitation58CFSv2_Ensemble_9_Temperature59CFSv2_Ensemble_9_Precipitation60CFSv2_Ensemble_10_Temperature61CFSv2_Ensemble_10_Precipitation62CFSv2_Ensemble_11_Temperature63CFSv2_Ensemble_11_Precipitation64CFSv2_Ensemble_12_Temperature65CFSv2_Ensemble_12_Precipitation66CFSv2_Ensemble_13_Temperature67CFSv2_Ensemble_13_Precipitation68CFSv2_Ensemble_14_Temperature69CFSv2_Ensemble_14_Precipitation70CFSv2_Ensemble_15_Temperature71CFSv2_Ensemble_15_Precipitation72CFSv2_Ensemble_16_Temperature73CFSv2_Ensemble_16_Precipitation74CFSv2_Ensemble_17_Temperature75CFSv2_Ensemble_17_Precipitation76CFSv2_Ensemble_18_Temperature77CFSv2_Ensemble_18_Precipitation78CFSv2_Ensemble_19_Temperature79CFSv2_Ensemble_19_Precipitation80CFSv2_Ensemble_20_Temperature81CFSv2_Ensemble_20_Precipitation82CFSv2_Ensemble_21_Temperature83CFSv2_Ensemble_21_Precipitation84CFSv2_Ensemble_22_Temperature85CFSv2_Ensemble_22_Precipitation86CFSv2_Ensemble_23_Temperature87CFSv2_Ensemble_23_Precipitation88CFSv2_Ensemble_24_Temperature89CFSv2_Ensemble_24_PrecipitationLicenseDistributed under the MIT License. SeeLICENSE.txtfor more information.