Skip to content

Instantly share code, notes, and snippets.

@bennyistanto
Created June 16, 2021 09:46
Show Gist options
  • Save bennyistanto/33cd0e7daa717520a9ffddf8455a1bfb to your computer and use it in GitHub Desktop.
Save bennyistanto/33cd0e7daa717520a9ffddf8455a1bfb to your computer and use it in GitHub Desktop.
Check GFS data availability from EarthEngine
Here's the procedure
1. Access GFS data via GEE, example: https://code.earthengine.google.com/de11b37bc8010d4a7b0316e95fdc360c
2. In the Console, you will get "ImageCollection NOAA/GFS0P25 (24 elements)", then klik JSON in the right.
3. Click {, Copy and Paste in Text Editor, and save as result.json
4. Run "python parse.py" in the same directory with point 3.
import json
import csv
import sys
import datetime as dt
with open('result.json') as f:
content = json.load(f)
w = csv.writer(sys.stdout)
def to_date(v):
return dt.datetime.fromtimestamp(v/1000).strftime('%Y-%m-%d %H:%M:%S')
for i,f in enumerate(content['features']):
p = f['properties']
row = [
['creation_time', to_date(p['creation_time'])],
['system:time_start', to_date(p['system:time_start'])],
['system:time_end', to_date(p['system:time_end'])],
['forecast_time', to_date(p['forecast_time'])],
['forecast_hours', p['forecast_hours']]
]
if i == 0:
w.writerow(e[0] for e in row)
w.writerow(e[1] for e in row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment