Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 22, 2024
1 parent 067aaa2 commit 4804f6d
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions docs/partial-inputs-flood-tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
"multi_model = CLAYModule.load_from_checkpoint(\n",
" CKPT_PATH,\n",
" mask_ratio=0.0,\n",
" band_groups={\"rgb\": (2, 1, 0), \"nir\": (3,), \"swir\": (4,5)},\n",
" band_groups={\"rgb\": (2, 1, 0), \"nir\": (3,), \"swir\": (4, 5)},\n",
" bands=6,\n",
" strict=False, # ignore the extra parameters in the checkpoint\n",
")\n",
Expand All @@ -427,7 +427,6 @@
" 2893.86, # nir\n",
" 2303.00, # swir16\n",
" 1807.79, # swir22\n",
" \n",
" ]\n",
" STD = [\n",
" 2026.96, # red\n",
Expand Down Expand Up @@ -472,7 +471,7 @@
" batch[\"pixels\"] = batch[\"pixels\"].to(multi_model.device)\n",
" # Pass just the specific band through the model\n",
" batch[\"timestep\"] = batch[\"timestep\"].to(multi_model.device)\n",
" batch[\"date\"] = batch[\"date\"] #.to(multi_model.device)\n",
" batch[\"date\"] = batch[\"date\"] # .to(multi_model.device)\n",
" batch[\"latlon\"] = batch[\"latlon\"].to(multi_model.device)\n",
"\n",
" # Pass pixels, latlon, timestep through the encoder to create encoded patches\n",
Expand Down Expand Up @@ -651,17 +650,17 @@
"plt.xticks(rotation=-30)\n",
"# All points\n",
"plt.scatter(tss, pca_result, color=\"blue\")\n",
"#plt.scatter(stack.time, pca_result, color=\"blue\")\n",
"# plt.scatter(stack.time, pca_result, color=\"blue\")\n",
"\n",
"# Cloudy images\n",
"plt.scatter(tss[7], pca_result[7], color=\"green\")\n",
"plt.scatter(tss[8], pca_result[8], color=\"green\")\n",
"#plt.scatter(stack.time[7], pca_result[7], color=\"green\")\n",
"#plt.scatter(stack.time[8], pca_result[8], color=\"green\")\n",
"# plt.scatter(stack.time[7], pca_result[7], color=\"green\")\n",
"# plt.scatter(stack.time[8], pca_result[8], color=\"green\")\n",
"\n",
"# After flood\n",
"plt.scatter(tss[-7:], pca_result[-7:], color=\"red\")\n",
"#plt.scatter(stack.time[-7:], pca_result[-7:], color=\"red\")"
"# plt.scatter(stack.time[-7:], pca_result[-7:], color=\"red\")"
]
},
{
Expand Down Expand Up @@ -691,7 +690,6 @@
"outputs": [],
"source": [
"from sklearn.manifold import TSNE\n",
"from sklearn.ensemble import IsolationForest\n",
"\n",
"# Perform t-SNE on the embeddings\n",
"tsne = TSNE(n_components=2, perplexity=5)\n",
Expand Down Expand Up @@ -722,11 +720,11 @@
"\n",
"# Annotate each point with the corresponding date\n",
"for i, (x, y) in enumerate(zip(X_tsne[:, 0], X_tsne[:, 1])):\n",
" plt.annotate(f'{tss[i]}', (x, y))\n",
" \n",
"plt.title('t-SNE Visualization')\n",
"plt.xlabel('t-SNE Component 1')\n",
"plt.ylabel('t-SNE Component 2')\n",
" plt.annotate(f\"{tss[i]}\", (x, y))\n",
"\n",
"plt.title(\"t-SNE Visualization\")\n",
"plt.xlabel(\"t-SNE Component 1\")\n",
"plt.ylabel(\"t-SNE Component 2\")\n",
"plt.show()"
]
},
Expand Down

0 comments on commit 4804f6d

Please sign in to comment.