Giter VIP home page Giter VIP logo

climateservpy's Introduction

ClimateServ API Access

Python: 3.7 License: MIT SERVIR: Global DOI

This is a python package to access the ClimateSERV API you can install using conda or pip:

  • conda install -c servir climateserv
  • pip install climateserv

Current supported operations:

  • Timeseries CSV
    • Variables
      • Average
      • Min
      • Max
  • Download Zip file of tifs
    • Variable
      • Download
  • Download Zip file containing a NetCDF
    • Variable
      • NetCDF

Current supported datasets:

We are moving to the dataset numbers to match the way ClimateSERV handles the datasets. We will continue to support the prior named variables for the datasets, but recommend updating to use the integer values. This will allow any future datasets that are added to be accessed by their ID found on ClimateSERV even if this documentation is not yet updated.

  • UCSB CHIRPS Rainfall: 0
  • eMODIS West Africa NDVI: 1
  • eMODIS East Africa NDVI: 2
  • eMODIS Southern Africa NDVI: 5
  • IMERG 1 Day (late): 26
  • eMODIS Central Asia NDVI: 28
  • Evaporative Stress Index (ESI) 4 week: 29
  • CHIRPS GEFS Anomalies: 31
  • CHIRPS GEFS Precipitation: 32
  • Evaporative Stress Index (ESI) 12 week: 33
  • NASA-USDA Enhanced SMAP Global Soil moisture profile: 37
  • NASA-USDA Enhanced SMAP Global Surface soil moisture: 38
  • NASA-USDA Enhanced SMAP Global Surface soil moisture anomaly: 39
  • NASA-USDA Enhanced SMAP Global Subsurface soil moisture: 40
  • NASA-USDA Enhanced SMAP Global Subsurface soil moisture anomaly: 41
  • UCSB CHIRP Rainfall: 90
  • IMERG 1 Day (early): 91
  • NSIDC SMAP Sentinel 1Km: 541
  • NSIDC SMAP Sentinel 1Km 15 day: 542
  • LIS-modeled Evapotranspiration: 661
  • LIS-modeled Baseflow: 662
  • LIS-Modeled Runoff: 663
  • LIS-Modeled Soil Moisture 0-10cm: 664
  • LIS-Modeled Soil Moisture 10-40cm: 665
  • LIS-Modeled Soil Moisture 40-100cm: 666
  • LIS-Modeled Soil Moisture 100-200cm: 667

NMME forecast datasets:

CCSM4

  • NMME ccsm4 ens01 Temperature: 6
  • NMME ccsm4 ens01 Precipitation: 7
  • NMME ccsm4 ens02 Temperature: 8
  • NMME ccsm4 ens02 Precipitation: 9
  • NMME ccsm4 ens03 Temperature: 10
  • NMME ccsm4 ens03 Precipitation: 11
  • NMME ccsm4 ens04 Temperature: 12
  • NMME ccsm4 ens04 Precipitation: 13
  • NMME ccsm4 ens05 Temperature: 14
  • NMME ccsm4 ens05 Precipitation: 15
  • NMME ccsm4 ens06 Temperature: 16
  • NMME ccsm4 ens06 Precipitation: 17
  • NMME ccsm4 ens07 Temperature: 18
  • NMME ccsm4 ens07 Precipitation: 19
  • NMME ccsm4 ens08 Temperature: 20
  • NMME ccsm4 ens08 Precipitation: 21
  • NMME ccsm4 ens09 Temperature: 22
  • NMME ccsm4 ens09 Precipitation: 23
  • NMME ccsm4 ens10 Temperature: 24
  • NMME ccsm4 ens10 Precipitation: 25

CSFV2

  • NMME cfsv2 ens01 Temperature: 42
  • NMME cfsv2 ens01 Precipitation: 43
  • NMME cfsv2 ens02 Temperature: 44
  • NMME cfsv2 ens02 Precipitation: 45
  • NMME cfsv2 ens03 Temperature: 46
  • NMME cfsv2 ens03 Precipitation: 47
  • NMME cfsv2 ens04 Temperature: 48
  • NMME cfsv2 ens04 Precipitation: 49
  • NMME cfsv2 ens05 Temperature: 50
  • NMME cfsv2 ens05 Precipitation: 51
  • NMME cfsv2 ens06 Temperature: 52
  • NMME cfsv2 ens06 Precipitation: 53
  • NMME cfsv2 ens07 Temperature: 54
  • NMME cfsv2 ens07 Precipitation: 55
  • NMME cfsv2 ens08 Temperature: 56
  • NMME cfsv2 ens08 Precipitation: 57
  • NMME cfsv2 ens09 Temperature: 58
  • NMME cfsv2 ens09 Precipitation: 59
  • NMME cfsv2 ens10 Temperature: 60
  • NMME cfsv2 ens10 Precipitation: 61
  • NMME cfsv2 ens11 Temperature: 62
  • NMME cfsv2 ens11 Precipitation: 63
  • NMME cfsv2 ens12 Temperature: 64
  • NMME cfsv2 ens12 Precipitation: 65
  • NMME cfsv2 ens13 Temperature: 66
  • NMME cfsv2 ens13 Precipitation: 67
  • NMME cfsv2 ens14 Temperature: 68
  • NMME cfsv2 ens14 Precipitation: 69
  • NMME cfsv2 ens15 Temperature: 70
  • NMME cfsv2 ens15 Precipitation: 71
  • NMME cfsv2 ens16 Temperature: 72
  • NMME cfsv2 ens16 Precipitation: 73
  • NMME cfsv2 ens17 Temperature: 74
  • NMME cfsv2 ens17 Precipitation: 75
  • NMME cfsv2 ens18 Temperature: 76
  • NMME cfsv2 ens18 Precipitation: 77
  • NMME cfsv2 ens19 Temperature: 78
  • NMME cfsv2 ens19 Precipitation: 79
  • NMME cfsv2 ens20 Temperature: 80
  • NMME cfsv2 ens20 Precipitation: 81
  • NMME cfsv2 ens21 Temperature: 82
  • NMME cfsv2 ens21 Precipitation: 83
  • NMME cfsv2 ens22 Temperature: 84
  • NMME cfsv2 ens22 Precipitation: 85
  • NMME cfsv2 ens23 Temperature: 86
  • NMME cfsv2 ens23 Precipitation: 87
  • NMME cfsv2 ens24 Temperature: 88
  • NMME cfsv2 ens24 Precipitation: 89

Sample Usage

This is sample code to produce a time series csv using the CentralAsia_eModis dataset. If you were to choose the OperationType of Download you would need to change the Outfile from .csv to .zip If you would like the data returned as a json object to a variable set Outfile to 'memory_object' and create a variable to hold the return from the climateserv.api.request_data call.

import climateserv.api

x = 81.27   
y = 29.19

GeometryCoords = [[x-.01,y+.01],[x+.01, y+.01],
                  [x+.01, y-.01],[x-.01,y-.01],[x-.01,y+.01]]
                  
DatasetType = 28
OperationType = 'Average'
EarliestDate = '01/03/2018'
LatestDate = '03/16/2018'
SeasonalEnsemble = '' # Leave empty when using the new integer dataset IDs
SeasonalVariable = '' # Leave empty when using the new integer dataset IDs
Outfile = 'out.csv'

climateserv.api.request_data(DatasetType, OperationType, 
             EarliestDate, LatestDate,GeometryCoords, 
             SeasonalEnsemble, SeasonalVariable,Outfile)

License and Distribution

ClimateSERVpy is distributed by SERVIR under the terms of the MIT License. See LICENSE in this directory for more information.

Privacy & Terms of Use

ClimateSERVpy abides to all of SERVIR's privacy and terms of use as described at https://servirglobal.net/Privacy-Terms-of-Use.

climateservpy's People

Contributors

billyz313 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

climateservpy's Issues

Bad Data in CHIRPS-GEFS Anamloy Dataset

Hello, when I attempt to import CHIRPS-GEFS Anamoly dataset (Dataset_Type = 'CHIRPS_GEFS_anom') into Python, I get bad data (-9999.0) for 20 years. October 5, 2020 is the first day that I get usable data. Is this functioning as intended? I've attached a screenshot of my code
ClimateSERV_GEFS_Issue
.

Values of Temperature and Precipitation

I know this is not a bug in your code, but I used these params:

GeometryCoords = [[14.6937, -17.44406]]

DatasetType = 'Seasonal_Forecast'
OperationType = 'Min' #Use download here to download the TIF files
EarliestDate = '01/12/2018'
LatestDate = '01/12/2019'
SeasonalEnsemble = 'ens06'
SeasonalVariable = 'Temperature'
Outfile = 'out.csv'

And the values of temperature are around 287-296. I am not sure why that is happening. Please help.

[SSL: CERTIFICATE_VERIFY_FAILED]

Hi team! I try to use your API, but its failling i dont know why, could some one help me?

To my co-worker its working fine the same code.

I recieve this error:

New Script Run
About to process scripted job item now.
New Job Submitted to the Server: New JobID: d507ab41-1ccc-49cd-a55a-2cbd4612d5e1
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)>
get_JobProgressValue_FromResponse: Something went wrong..Generic Catch All Error. 'NoneType' object is not subscriptable
Current Job Progress: -1. JobID: d507ab41-1ccc-49cd-a55a-2cbd4612d5e1
Result of Job Status Cycle: error_generic
Job, d507ab41-1ccc-49cd-a55a-2cbd4612d5e1 is done, did it succeed? : False
ERROR. There was an error with this job.
(The error may have been caused by an error on the server.)
Double check the parameters you set and try again. If the error persists, please contact the ClimateSERV Staff and be sure to send the parameters you used. Thank you!
ERROR. There was an error with this job.
(The error may have been caused by an error on the server.)
Double check the parameters you set and try again. If the error persists, please contact the ClimateSERV Staff and be sure to send the parameters you used. Thank you!

I was thinking ok, it is related with the SSL certificate but then i run this code:

`import requests

def test_ssl_certificates():
"""Test SSL certificates by making an HTTPS request."""
test_url = 'https://www.google.com' # A simple test URL
try:
response = requests.get(test_url)
print(f"Success: Response code {response.status_code}")
except requests.exceptions.SSLError as e:
print(f"SSL Error: {e}")
except Exception as e:
print(f"Error: {e}")

if name == "main":
test_ssl_certificates()`

And i get a: Success: Response code 200. 

Any body know why could be happening? Im using MAC and a python version of 3.9.

CHIRPS_GEFS_precip_75 silently failing?

Hello, I am running this code within Google Colab (Python v. 3.7.12) on My Mac (v 12.2.1)

When I attempt to write the CHIRPS_GEFS_Precipitation (75th percentile) data to a CSV file, the script runs without error.

However, the job progress indicator stays stuck at zero. I have tried restarting runtime, and running the code for over 10 minutes, both with no luck. I was able to use the 25th percentile and mean datasets with no issue, and haven't experienced this issue with any other ClimateSERV datasets.

Attached is a screenshot of my code and the aforementioned issue
Screen Shot 2022-02-23 at 4 05 41 PM

Docs Issue with eMODIS NDVI dataset and CHIRPS-GEFS Anamolies

Hello, I'm not sure if this is the best place to post this issue, but there is a small docs issue on the ClimateSERV help center website. Under the "Developers API" heading, it says the availability of the eMODIS NDVI datasets are pentadal, when they are dekadal according to the USGS website. Additionally, when we import the data into Python we can see that they are dekadal (See Attached image).

This issue is present for all of the NDVI datasets on ClimateSERV (Central Asia, Southern Africa, East Africa, West Africa)
ClimateSERV_NDVI_Issue

Additionally, this page claims that the CHIRPS-GEFS Anomalies data ranges from 1981 to present. While this is true for the CHIRPS precipitation data, it is not true for the CHIRPS-GEFS Anomalies data, which seems to begin on 01/01/2001.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.