You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
155 lines
3.5 KiB
155 lines
3.5 KiB
{ |
|
"cells": [ |
|
{ |
|
"cell_type": "code", |
|
"execution_count": null, |
|
"metadata": {}, |
|
"outputs": [], |
|
"source": [ |
|
"import folium\n", |
|
"import matplotlib\n", |
|
"from matplotlib.pyplot import imread\n", |
|
"from folium import raster_layers\n", |
|
"from scipy.ndimage import imread" |
|
] |
|
}, |
|
{ |
|
"cell_type": "code", |
|
"execution_count": null, |
|
"metadata": {}, |
|
"outputs": [], |
|
"source": [ |
|
"# m = folium.Map([-17.1725, -47.3288], zoom_start=13)\n", |
|
"m = folium.Map([-16.47, -47.43], zoom_start=12, control_scale=True)\n", |
|
"# boundsdata = r'map.geojson'\n", |
|
"# folium.GeoJson(boundsdata).add_to(m)" |
|
] |
|
}, |
|
{ |
|
"cell_type": "code", |
|
"execution_count": null, |
|
"metadata": {}, |
|
"outputs": [], |
|
"source": [ |
|
"# read in png file to numpy array\n", |
|
"# image = '/notebooks/resources/T22KHG_20190425T132241_TCI.tif'\n", |
|
"# image = '/notebooks/resources/T22KHG_20190425T132241_TCI_quarter.tif'\n", |
|
"image = '/notebooks/resources/T22KHG_20190425T132241_TCI_smaller.tif'\n", |
|
"data = matplotlib.pyplot.imread(image)\n", |
|
"\n", |
|
"# boundary of the image on the map\n", |
|
"# -47.72086687985285,-47.18137037025522,-16.627150415017045,-16.329425174039407 [EPSG:4326]\n", |
|
"# -47.72,-47.18,-16.62,-16.32\n", |
|
"# min_lon = -47.3566\n", |
|
"# max_lon = -47.1719\n", |
|
"# min_lat = -16.4769\n", |
|
"# max_lat = -16.6105\n", |
|
"min_lon = -47.72086687985285\n", |
|
"max_lon = -47.18137037025522\n", |
|
"min_lat = -16.627150415017045\n", |
|
"max_lat = -16.329425174039407\n", |
|
"\n", |
|
"# Overlay the image\n", |
|
"m.add_child(raster_layers.ImageOverlay(data,\n", |
|
"# opacity = 0.8,\n", |
|
" bounds = [[min_lat, min_lon], [max_lat, max_lon]]))\n", |
|
"\n", |
|
"m" |
|
] |
|
}, |
|
{ |
|
"cell_type": "code", |
|
"execution_count": null, |
|
"metadata": {}, |
|
"outputs": [], |
|
"source": [ |
|
"import h5py\n", |
|
"hdf5 = '/notebooks/resources/3B-MO.MS.MRG.3IMERG.20190101-S000000-E235959.01.V06A.HDF5'\n", |
|
"dataset = h5py.File(hdf5,'r')" |
|
] |
|
}, |
|
{ |
|
"cell_type": "code", |
|
"execution_count": null, |
|
"metadata": {}, |
|
"outputs": [], |
|
"source": [ |
|
"import numpy as np\n", |
|
"precip = dataset['Grid/precipitation'][:]\n", |
|
"precip = np.transpose(precip[0])\n", |
|
"\n", |
|
"theLats = dataset['Grid/lat'][:]\n", |
|
"theLons = dataset['Grid/lon'][:]" |
|
] |
|
}, |
|
{ |
|
"cell_type": "code", |
|
"execution_count": null, |
|
"metadata": {}, |
|
"outputs": [], |
|
"source": [ |
|
"precip[728,1326]" |
|
] |
|
}, |
|
{ |
|
"cell_type": "code", |
|
"execution_count": null, |
|
"metadata": {}, |
|
"outputs": [], |
|
"source": [ |
|
"theLats[728]" |
|
] |
|
}, |
|
{ |
|
"cell_type": "code", |
|
"execution_count": null, |
|
"metadata": {}, |
|
"outputs": [], |
|
"source": [ |
|
"theLons[1326]" |
|
] |
|
}, |
|
{ |
|
"cell_type": "code", |
|
"execution_count": null, |
|
"metadata": {}, |
|
"outputs": [], |
|
"source": [] |
|
}, |
|
{ |
|
"cell_type": "code", |
|
"execution_count": null, |
|
"metadata": {}, |
|
"outputs": [], |
|
"source": [] |
|
}, |
|
{ |
|
"cell_type": "code", |
|
"execution_count": null, |
|
"metadata": {}, |
|
"outputs": [], |
|
"source": [] |
|
} |
|
], |
|
"metadata": { |
|
"kernelspec": { |
|
"display_name": "Python 3", |
|
"language": "python", |
|
"name": "python3" |
|
}, |
|
"language_info": { |
|
"codemirror_mode": { |
|
"name": "ipython", |
|
"version": 3 |
|
}, |
|
"file_extension": ".py", |
|
"mimetype": "text/x-python", |
|
"name": "python", |
|
"nbconvert_exporter": "python", |
|
"pygments_lexer": "ipython3", |
|
"version": "3.5.2" |
|
} |
|
}, |
|
"nbformat": 4, |
|
"nbformat_minor": 2 |
|
}
|
|
|