Last active
December 10, 2019 23:40
-
-
Save abarciauskas-bgse/1ff3ebb13726ee1e151a380d1d83f528 to your computer and use it in GitHub Desktop.
atl03_h_ph.geojson
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 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment