| 1 |
{ |
| 2 |
"cells": [ |
| 3 |
{ |
| 4 |
"cell_type": "code", |
| 5 |
"execution_count": null, |
| 6 |
"id": "f4244124", |
| 7 |
"metadata": {}, |
| 8 |
"outputs": [], |
| 9 |
"source": [ |
| 10 |
"from polsarpro.io import open_netcdf_beam\n", |
| 11 |
"from polsarpro.speckle_filters import refined_lee\n", |
| 12 |
"from polsarpro.decompositions import freeman\n", |
| 13 |
"from polsarpro.util import S_to_C3, multilook" |
| 14 |
] |
| 15 |
}, |
| 16 |
{ |
| 17 |
"cell_type": "code", |
| 18 |
"execution_count": null, |
| 19 |
"id": "49af1167", |
| 20 |
"metadata": {}, |
| 21 |
"outputs": [], |
| 22 |
"source": [ |
| 23 |
"S = open_netcdf_beam(\"/data/psp/biomass_test.nc\")" |
| 24 |
] |
| 25 |
}, |
| 26 |
{ |
| 27 |
"cell_type": "code", |
| 28 |
"execution_count": null, |
| 29 |
"id": "82eed5ef", |
| 30 |
"metadata": {}, |
| 31 |
"outputs": [], |
| 32 |
"source": [ |
| 33 |
"S" |
| 34 |
] |
| 35 |
}, |
| 36 |
{ |
| 37 |
"cell_type": "code", |
| 38 |
"execution_count": null, |
| 39 |
"id": "5eeff7f1", |
| 40 |
"metadata": {}, |
| 41 |
"outputs": [], |
| 42 |
"source": [ |
| 43 |
"C3 = S_to_C3(S)" |
| 44 |
] |
| 45 |
}, |
| 46 |
{ |
| 47 |
"cell_type": "code", |
| 48 |
"execution_count": null, |
| 49 |
"id": "17693036", |
| 50 |
"metadata": {}, |
| 51 |
"outputs": [], |
| 52 |
"source": [ |
| 53 |
"C3 = multilook(C3, dim_az=6, dim_rg=1)" |
| 54 |
] |
| 55 |
}, |
| 56 |
{ |
| 57 |
"cell_type": "code", |
| 58 |
"execution_count": null, |
| 59 |
"id": "1d883781", |
| 60 |
"metadata": {}, |
| 61 |
"outputs": [], |
| 62 |
"source": [ |
| 63 |
"out = freeman(C3, boxcar_size=[5, 5])" |
| 64 |
] |
| 65 |
}, |
| 66 |
{ |
| 67 |
"cell_type": "code", |
| 68 |
"execution_count": null, |
| 69 |
"id": "126c5a13", |
| 70 |
"metadata": {}, |
| 71 |
"outputs": [], |
| 72 |
"source": [ |
| 73 |
"from dask.diagnostics import ProgressBar\n", |
| 74 |
"# execution happens now!\n", |
| 75 |
"with ProgressBar():\n", |
| 76 |
" out.to_netcdf(\"/data/psp/test.nc\")" |
| 77 |
] |
| 78 |
}, |
| 79 |
{ |
| 80 |
"cell_type": "code", |
| 81 |
"execution_count": null, |
| 82 |
"id": "9676cead", |
| 83 |
"metadata": {}, |
| 84 |
"outputs": [], |
| 85 |
"source": [ |
| 86 |
"import xarray as xr\n", |
| 87 |
"out = xr.open_dataset(\"/data/psp/test.nc\")" |
| 88 |
] |
| 89 |
}, |
| 90 |
{ |
| 91 |
"cell_type": "code", |
| 92 |
"execution_count": null, |
| 93 |
"id": "b7076743", |
| 94 |
"metadata": {}, |
| 95 |
"outputs": [], |
| 96 |
"source": [ |
| 97 |
"import matplotlib.pyplot as plt\n", |
| 98 |
"plt.figure(figsize=(10, 10))\n", |
| 99 |
"plt.imshow(out.odd, interpolation=\"none\", vmax=1)\n", |
| 100 |
"plt.colorbar(fraction=0.046, pad=0.04)" |
| 101 |
] |
| 102 |
}, |
| 103 |
{ |
| 104 |
"cell_type": "code", |
| 105 |
"execution_count": null, |
| 106 |
"id": "4d07fb42", |
| 107 |
"metadata": {}, |
| 108 |
"outputs": [], |
| 109 |
"source": [ |
| 110 |
"from polsarpro.util import pauli_rgb\n", |
| 111 |
"\n", |
| 112 |
"rgb = pauli_rgb(C3)" |
| 113 |
] |
| 114 |
}, |
| 115 |
{ |
| 116 |
"cell_type": "code", |
| 117 |
"execution_count": null, |
| 118 |
"id": "438d95b2", |
| 119 |
"metadata": {}, |
| 120 |
"outputs": [], |
| 121 |
"source": [ |
| 122 |
"rgb.plot.imshow()" |
| 123 |
] |
| 124 |
} |
| 125 |
], |
| 126 |
"metadata": { |
| 127 |
"kernelspec": { |
| 128 |
"display_name": "psp", |
| 129 |
"language": "python", |
| 130 |
"name": "python3" |
| 131 |
}, |
| 132 |
"language_info": { |
| 133 |
"codemirror_mode": { |
| 134 |
"name": "ipython", |
| 135 |
"version": 3 |
| 136 |
}, |
| 137 |
"file_extension": ".py", |
| 138 |
"mimetype": "text/x-python", |
| 139 |
"name": "python", |
| 140 |
"nbconvert_exporter": "python", |
| 141 |
"pygments_lexer": "ipython3", |
| 142 |
"version": "3.12.12" |
| 143 |
} |
| 144 |
}, |
| 145 |
"nbformat": 4, |
| 146 |
"nbformat_minor": 5 |
| 147 |
} |