Created
October 25, 2022 22:16
-
-
Save hbshrestha/19a6829eb0aeec2de6a3d7e298d4f2f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, json, requests | |
#all sky surface shortwave downward irradiance | |
radiation_parameter = "ALLSKY_SFC_SW_DWN" | |
#url for irradiance | |
base_url = r"https://power.larc.nasa.gov/api/temporal/hourly/point?parameters=ALLSKY_SFC_SW_DWN&community=RE&time-standard=UTC&longitude={longitude}&latitude={latitude}&format=JSON&start=2020&end=2020" | |
rad_data = [] | |
for latitude, longitude in places: | |
api_request_url = base_url.format(longitude=longitude, latitude=latitude) | |
response = requests.get(url=api_request_url, verify=True, timeout=200.00) | |
content = json.loads(response.content.decode('utf-8')) | |
rad_data.append(content["properties"]["parameter"][radiation_parameter]) | |
df = pd.DataFrame(rad_data).T | |
df.columns = cities | |
df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment