Skip to content

Instantly share code, notes, and snippets.

@abarciauskas-bgse
Last active December 10, 2019 23:40
Show Gist options
  • Save abarciauskas-bgse/1ff3ebb13726ee1e151a380d1d83f528 to your computer and use it in GitHub Desktop.
Save abarciauskas-bgse/1ff3ebb13726ee1e151a380d1d83f528 to your computer and use it in GitHub Desktop.
atl03_h_ph.geojson
import h5py
import json
f = h5py.File('ATL03_20181013235645_02340114_002_01.h5')
limit = 100
# Should do this for gt1l, gt2r, gt2l, gt3r, gtl3
heights = f['gt1r']['heights']
feature_collection = {
"type": "FeatureCollection",
"totalFeatures": limit,
"features": []
}
features_list = []
for idx in range(0, limit):
height = float(heights['h_ph'][idx])
latitude = float(heights['lat_ph'][idx])
longitude = float(heights['lon_ph'][idx])
feature = {
"type": "Feature",
"id": "",
"geometry": {
"type": "Point",
"coordinates": [ longitude, latitude ]
},
"geonemtry_name": "GeoLocation",
"properties": {
"photon_height_meters": height,
"icon": "harbor",
"title": f"photon-{idx}"
}
}
features_list.append(feature)
feature_collection['features'] = features_list
with open('atl03_h_ph.json', 'w') as outfile:
json.dump(feature_collection, outfile)
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment