Skip to content

Commit

Permalink
update model prediction notebook for external use
Browse files Browse the repository at this point in the history
  • Loading branch information
John Brandt committed Jul 21, 2020
1 parent f090a72 commit 8057fab
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 533 deletions.
169 changes: 7 additions & 162 deletions notebooks/.ipynb_checkpoints/4a-download-large-area-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
"metadata": {},
"outputs": [],
"source": [
"year = 2017\n",
"year = 2019\n",
"dates = ('{}-12-01'.format(str(year - 1)) , '{}-02-01'.format(str(year + 1)))\n",
"dates_sentinel_1 = ('{}-01-01'.format(str(year)) , '{}-12-31'.format(str(year)))\n",
"SIZE = 9*5\n",
Expand All @@ -187,7 +187,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"../tile_data/brazil-gulley-east/ (-51.829941, -21.971591)\n"
"../tile_data/brazil-buffer/ (-50.364266, -20.117451)\n"
]
}
],
Expand Down Expand Up @@ -271,7 +271,7 @@
" 'brazil-gulley-east': (-21.971591, -51.829941)\n",
"}\n",
"\n",
"landscape = 'brazil-gulley-east'\n",
"landscape = 'brazil-buffer'\n",
"OUTPUT_FOLDER = '../tile_data/{}/'.format(landscape)\n",
"coords = landscapes[landscape]\n",
"coords = (coords[1], coords[0])\n",
Expand Down Expand Up @@ -980,6 +980,7 @@
" if 'clean_steps' not in globals() or locals():\n",
" clean_steps = hkl.load(clean_steps_file)\n",
" s2, s2_dates = download_layer(bbx, clean_steps = clean_steps, epsg = epsg)\n",
" print(s2_dates)\n",
" hkl.dump(s2, s2_file, mode='w', compression='gzip')\n",
" hkl.dump(s2_dates, s2_dates_file, mode='w', compression='gzip')\n",
"\n",
Expand Down Expand Up @@ -1168,158 +1169,9 @@
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Downloading 2019 for brazil-gulley-east\n",
"Download 0/1; X: 0 Y:0\n",
"Downloading clouds because ../tile_data/brazil-gulley-east/raw/clouds/clouds_0_0.hkl does not exist\n",
"Cloud_probs used 0.2 processing units\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2ccbd65885414697ab0779b181887b43",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(IntProgress(value=0, max=59), HTML(value='')))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a93939612c8547bfb45a954d4c395894",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(IntProgress(value=0, max=59), HTML(value='')))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Shadows ((59, 646, 646)) used 23.5 processing units\n",
"Downloading S1 because ../tile_data/brazil-gulley-east/raw/s1/0_0.hkl does not exist\n",
"Loading formatted geocoded file...\n",
"The continent is: SA, and the sentinel 1 orbit is SENT_DESC\n",
"Sentinel 1 used 63.7 PU for 30 out of 30 images\n",
"Maximum time distance: 24\n",
"Downloading S2 because ../tile_data/brazil-gulley-east/raw/s2/0_0.hkl does not exist\n",
"Original 20 meter bands size: (59, 323, 323, 6), using 47.0 PU\n",
"Original 10 meter bands size: (59, 646, 646, 4), using 125.2 PU\n",
"Sentinel 2 used 172.2 PU\n",
"DEM used 3.2 processing units\n",
"4 Cloudy and missing images removed, radar processed: [ 0 4 28 41]\n",
"1 missed cloudy images were removed: [[42]]\n",
"Interpolated 593700 px\n",
"Clouds and shadows interpolated\n",
"2 steps removed because of >50% interpolation rate\n",
"Super resolving tile\n",
"The input array to superresolve is (54, 646, 646, 10)\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b73a1d2cb01f4d9e81086f4eabc893e3",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(IntProgress(value=0, max=144), HTML(value='')))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"1: The output file is ../tile_data/brazil-gulley-east/processed/4/0.hkl\n",
"Maximum time distance: 30\n",
"2: The output file is ../tile_data/brazil-gulley-east/processed/4/1.hkl\n",
"Maximum time distance: 30\n",
"3: The output file is ../tile_data/brazil-gulley-east/processed/4/2.hkl\n",
"Maximum time distance: 30\n",
"4: The output file is ../tile_data/brazil-gulley-east/processed/4/3.hkl\n",
"Maximum time distance: 30\n",
"5: The output file is ../tile_data/brazil-gulley-east/processed/4/4.hkl\n",
"Maximum time distance: 30\n",
"6: The output file is ../tile_data/brazil-gulley-east/processed/3/0.hkl\n",
"Maximum time distance: 30\n",
"7: The output file is ../tile_data/brazil-gulley-east/processed/3/1.hkl\n",
"Maximum time distance: 30\n",
"8: The output file is ../tile_data/brazil-gulley-east/processed/3/2.hkl\n",
"Maximum time distance: 30\n",
"9: The output file is ../tile_data/brazil-gulley-east/processed/3/3.hkl\n",
"Maximum time distance: 30\n",
"10: The output file is ../tile_data/brazil-gulley-east/processed/3/4.hkl\n",
"Maximum time distance: 30\n",
"11: The output file is ../tile_data/brazil-gulley-east/processed/2/0.hkl\n",
"Maximum time distance: 30\n",
"12: The output file is ../tile_data/brazil-gulley-east/processed/2/1.hkl\n",
"Maximum time distance: 30\n",
"13: The output file is ../tile_data/brazil-gulley-east/processed/2/2.hkl\n",
"MSAVI2 negative sqrt at: 42, -0.05057139606062622\n",
"Maximum time distance: 30\n",
"14: The output file is ../tile_data/brazil-gulley-east/processed/2/3.hkl\n",
"Maximum time distance: 30\n",
"15: The output file is ../tile_data/brazil-gulley-east/processed/2/4.hkl\n",
"Maximum time distance: 30\n",
"16: The output file is ../tile_data/brazil-gulley-east/processed/1/0.hkl\n",
"Maximum time distance: 30\n",
"17: The output file is ../tile_data/brazil-gulley-east/processed/1/1.hkl\n",
"MSAVI2 negative sqrt at: 42, -0.11526017525848697\n",
"Maximum time distance: 30\n",
"18: The output file is ../tile_data/brazil-gulley-east/processed/1/2.hkl\n",
"MSAVI2 negative sqrt at: 42, -0.11535729042846077\n",
"Maximum time distance: 30\n",
"19: The output file is ../tile_data/brazil-gulley-east/processed/1/3.hkl\n",
"Maximum time distance: 30\n",
"20: The output file is ../tile_data/brazil-gulley-east/processed/1/4.hkl\n",
"Maximum time distance: 30\n",
"21: The output file is ../tile_data/brazil-gulley-east/processed/0/0.hkl\n",
"Maximum time distance: 30\n",
"22: The output file is ../tile_data/brazil-gulley-east/processed/0/1.hkl\n",
"Maximum time distance: 30\n",
"23: The output file is ../tile_data/brazil-gulley-east/processed/0/2.hkl\n",
"Maximum time distance: 30\n",
"24: The output file is ../tile_data/brazil-gulley-east/processed/0/3.hkl\n",
"Maximum time distance: 30\n",
"25: The output file is ../tile_data/brazil-gulley-east/processed/0/4.hkl\n",
"Maximum time distance: 30\n",
"\n",
"\n"
]
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"downloaded = 0\n",
"\n",
Expand All @@ -1342,13 +1194,6 @@
" process_large_tile(coords, x_tile, y_tile)\n",
" print(\"\\n\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
128 changes: 45 additions & 83 deletions notebooks/.ipynb_checkpoints/4b-predict-large-area-checkpoint.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 8057fab

Please sign in to comment.