Notebook for extracting data from the ODC

Notebook for extracting data from the ODC

The Notebook, " .../Real_world_examples/Scalable_machine_learning/1_Extract_training_data.ipynb",
extracts training data means for the polygons specified by the geojson file. For example,

# class blue green red nir swir_1 swir_2 red_edge_1 red_edge_2 red_edge_3 BCMAD EMAD SMAD NDVI LAI MNDWI slope
0.000000 1747.500000 2868.500000 4594.750000 5530.500000 7301.000000 6728.000000 5076.750000 5225.000000 5402.500000 0.011132 423.068390 0.000099 0.092427 0.164242 -0.435850 4.818419
0.000000 1274.250000 2244.000000 4093.750000 4813.000000 6223.750000 5890.500000 4540.000000 4649.000000 4746.500000 0.009977 340.271942 0.000136 0.080730 0.100092 -0.470062 8.802042


When I "comment out" the line "#    zonal_stats=zonal_stats,", the Notebook writes out the individual pixel values.

# class blue green red nir swir_1 swir_2 red_edge_1 red_edge_2 red_edge_3 BCMAD EMAD SMAD NDVI LAI MNDWI slope
0.000000 1264.000000 2211.000000 4022.000000 4729.000000 6179.000000 5835.000000 4457.000000 4566.000000 4659.000000 0.008964 308.452179 0.000140 0.080791 0.099651 -0.472944 9.877725
0.000000 1264.000000 2173.000000 3890.000000 4563.000000 6132.000000 5776.000000 4374.000000 4481.000000 4577.000000 0.009789 323.035645 0.000115 0.079617 0.096168 -0.476701 5.559027
0.000000 1292.000000 2299.000000 4233.000000 4981.000000 6293.000000 5963.000000 4654.000000 4764.000000 4862.000000 0.010488 366.870026 0.000148 0.081181 0.102459 -0.464851 11.334558
0.000000 1277.000000 2293.000000 4230.000000 4979.000000 6291.000000 5988.000000 4675.000000 4785.000000 4888.000000 0.010667 362.729950 0.000142 0.081333 0.102090 -0.465750 8.436857
0.000000 1739.000000 2877.000000 4653.000000 5596.000000 7379.000000 6800.000000 5148.000000 5299.000000 5474.000000 0.010945 415.463287 0.000098 0.092009 0.161915 -0.438963 4.602234
0.000000 1745.000000 2859.000000 4556.000000 5501.000000 7279.000000 6718.000000 5036.000000 5186.000000 5367.000000 0.010454 405.890564 0.000097 0.093964 0.169317 -0.435983 5.034603
0.000000 1752.000000 2883.000000 4641.000000 5567.000000 7327.000000 6743.000000 5130.000000 5277.000000 5448.000000 0.012143 461.757233 0.000100 0.090713 0.158671 -0.435260 4.602234
0.000000 1754.000000 2855.000000 4529.000000 5458.000000 7219.000000 6651.000000 4993.000000 5138.000000 5321.000000 0.010988 409.162476 0.000101 0.093021 0.167063 -0.433194 5.034603

Qu 1: In this latter case, how can I add the training class (TC) # (in the Notebook example, 1 - 156) and the TC pixel count (1-4) to the end of each record?

The Notebook example outputs geomedians, and some derived indices and a slope.

Qu 2: What changes do I need to make to the Notebook so that it writes the TC data for the observed Sentinel 2 band values for a date range?