In [1]:
import ee
import geopandas as gpd
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

import agrigee_lite as agl

np.set_printoptions(suppress=True)
np.set_printoptions(precision=2)
pd.set_option('display.float_format', '{:.2f}'.format)
In [3]:
ee.Initialize(opt_url="https://earthengine-highvolume.googleapis.com", project="ee-paulagibrim")
In [4]:
agl.get_all_tasks()
Out[4]:
attempt create_time description destination_uris done end_time name priority progress script_uri start_time state total_batch_eecu_usage_seconds type update_time estimated_cost_usd_tier_1 estimated_cost_usd_tier_2 estimated_cost_usd_tier_3
0 1 2025-04-09 14:30:47.543693+00:00 download_720_samples https://drive.google.com/#folders/1Svmr-eQvig1... True 2025-04-09 15:19:43.152439+00:00 projects/ee-paulagibrim/operations/D2OS2JVGESB... 100 None None 2025-04-09 14:30:59.056455+00:00 SUCCEEDED 1528.78 EXPORT_FEATURES 2025-04-09 15:19:43.152439+00:00 0.17 0.12 0.07
In [5]:
gdf = gpd.read_parquet("california_with_crop_names.parquet")
gdf = gdf[gdf.year>=2019].reset_index(drop=True)
In [6]:
satellite = agl.sat.Sentinel2(use_sr=True)
In [8]:
row = gdf.iloc[0]

imgs = agl.get.multiple_images_multithread(row.geometry, row.start_date, row.end_date, satellite)
In [11]:
plt.imshow((imgs[0][:,:,[2,1,0]]/10000) * np.pi)
Out[11]:
<matplotlib.image.AxesImage at 0x7f12736e6f90>
No description has been provided for this image
In [12]:
sits = agl.get.single_sits(row.geometry, row.start_date, row.end_date, satellite)
In [13]:
sits
Out[13]:
01_doy 11_blue 12_green 13_red 14_re1 15_re2 16_re3 17_nir 18_re4 19_swir1 20_swir2
0 2 555 826 821 1343 1901 2041 2188 2204 2814 2011
1 7 916 1243 1108 1841 2728 2888 2948 3101 2910 1794
2 27 610 939 813 1446 2396 2556 2694 2715 2714 1781
3 37 425 806 589 1330 2486 2649 2841 2838 2436 1430
4 42 414 730 573 1294 2330 2510 2715 2667 2283 1406
5 72 493 850 670 1391 2669 2917 3163 3128 2452 1476
6 77 420 781 613 1361 2659 2893 3021 3115 2382 1389
7 87 369 737 510 1276 2690 2924 3140 3140 1899 1019
8 97 374 715 529 1271 2684 2948 3068 3199 2031 1132
9 102 607 910 759 1524 2837 3164 3386 3424 2140 1275
10 107 386 687 599 1275 2454 2720 2901 3021 2044 1194
11 112 447 684 678 1260 2267 2557 2779 2877 2132 1328
12 122 554 760 911 1394 2057 2329 2557 2673 2480 1640
13 127 568 800 1029 1527 2083 2333 2546 2705 2702 1726
14 132 628 817 1081 1489 1910 2146 2332 2498 2831 1930
15 137 652 882 1190 1583 1941 2157 2377 2505 2970 2007
16 147 843 1067 1353 1772 2152 2346 2507 2676 3335 2359
17 152 692 863 1131 1397 1623 1790 1877 2014 2894 2285
18 157 681 911 1215 1467 1679 1829 1958 2078 3059 2306
19 167 721 958 1328 1565 1742 1897 2058 2165 3270 2405
20 172 758 971 1340 1567 1717 1882 2038 2137 3305 2505
21 177 751 999 1389 1609 1748 1894 2050 2170 3389 2481
22 182 818 1038 1424 1634 1752 1913 2073 2159 3410 2589
23 187 802 1064 1479 1682 1809 1968 2161 2243 3492 2506
24 192 833 1073 1477 1697 1794 1961 2069 2214 3526 2638
25 197 818 1099 1529 1749 1860 2009 2138 2286 3585 2558
26 202 861 1107 1524 1750 1849 2025 2125 2289 3588 2647
27 207 847 1130 1560 1792 1898 2044 2142 2317 3641 2597
28 212 873 1132 1570 1757 1898 2060 2261 2331 3573 2617
29 217 1404 1663 2061 2315 2406 2543 2633 2803 3247 2386
30 222 861 1123 1569 1811 1921 2101 2233 2369 3625 2613
31 227 843 1156 1609 1842 1954 2114 2267 2397 3670 2541
32 232 822 1091 1534 1778 1897 2074 2235 2358 3626 2556
33 237 797 1110 1561 1818 1942 2096 2196 2397 3706 2513
34 242 825 1101 1552 1809 1922 2099 2226 2382 3650 2553
35 247 821 1137 1590 1849 1953 2121 2176 2396 3694 2506
36 252 835 1110 1568 1806 1947 2122 2285 2388 3611 2516
37 257 827 1129 1587 1813 1950 2109 2301 2396 3645 2451
38 262 876 1150 1613 1861 2001 2180 2355 2459 3666 2534
39 267 815 1133 1614 1838 1974 2128 2275 2420 3666 2442
40 272 767 1032 1513 1739 1883 2062 2300 2373 3583 2401
41 277 739 1051 1550 1765 1921 2091 2321 2395 3589 2334
42 282 786 1064 1545 1742 1885 2070 2323 2348 3554 2411
43 287 800 1104 1590 1794 1928 2093 2321 2388 3598 2358
44 292 770 1059 1546 1785 1911 2098 2264 2383 3555 2406
45 297 732 1055 1567 1793 1925 2084 2301 2397 3605 2333
46 302 786 1065 1553 1754 1880 2053 2269 2338 3548 2411
47 307 749 1081 1598 1785 1909 2073 2299 2379 3611 2343
48 312 823 1121 1614 1810 1933 2092 2331 2373 3571 2397
49 317 721 1118 1703 1932 2061 2236 2454 2565 3789 2463
50 322 708 1016 1542 1740 1874 2043 2283 2355 3607 2392
51 327 715 1022 1525 1766 1882 2052 2229 2364 3517 2276
52 332 658 676 962 1120 1187 1316 1440 1487 1174 630
53 362 502 762 728 1161 1644 1763 1882 1914 2341 1634