This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the workflow | |
eo_workflow = eolearn.core.LinearWorkflow( | |
add_sentinel2_data, # Sentinel-2 data task | |
add_cloud_mask, # cloud mask task | |
append_ndvi, # calculate ndvi | |
append_ndwi, # calculate ndwi | |
append_norm, # calculate norm | |
add_valid_mask, # add new feature: valid mask | |
add_count_valid, # add new feature: valid counts | |
*reference_task_array, # add an array of tasks for adding each reference label |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
p, t, w, h, d = features_array.shape | |
# move t axis from position 1 to position 3 | |
features_array = np.moveaxis(features_array, 1, 3) | |
# reshape array | |
features_array = features_array.reshape(p*w*h, t*d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Model | Overall Accuracy [%] | F_1 Score [%] | |
---|---|---|---|
No filtering/no masking | 92.8 | 92.6 | |
No filtering/with masking | 94.2 | 93.9 | |
With filtering/no masking | 94.0 | 93.8 | |
With filtering/with masking | 94.4 | 94.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Model | Overall Accuracy [%] | F_1 Score [%] | |
---|---|---|---|
Uniform at 16-day rate | 94.4 | 94.1 | |
Uniform at 8-day rate | 94.5 | 94.3 | |
Optimally selected | 94.6 | 94.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load EOPatch | |
EOPatch.load('path_to_eopatches/eopatch-0x6/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EOPatch( | |
data: { | |
BANDS: numpy.ndarray(shape=(80, 1010, 999, 6), dtype=float32) | |
} | |
mask: { | |
CLM: numpy.ndarray(shape=(80, 1010, 999, 1), dtype=uint8) | |
IS_DATA: numpy.ndarray(shape=(80, 1010, 999, 1), dtype=uint8) | |
IS_VALID: numpy.ndarray(shape=(80, 1010, 999, 1), dtype=bool) | |
} | |
mask_timeless: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eopatch.timestamp | |
eopatch.mask['LULC'] | |
eopatch.data['CLM'][0] | |
eopatch.data['BANDS'][5][..., [3, 2, 1]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
download_task = SentinelHubInputTask( | |
bands_feature=(FeatureType.DATA, 'RGB'), | |
bands = ['B04', 'B03', 'B02'], | |
resolution=10, | |
maxcc=1.0, | |
time_difference=timedelta(hours=2), | |
data_source=DataSource.SENTINEL2_L2A, | |
max_threads=10, | |
additional_data=[ | |
(FeatureType.MASK, 'dataMask'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() { | |
return { | |
input: ["sunZenithAngles", "sunAzimuthAngles"], | |
mosaicking: Mosaicking.ORBIT, | |
output: { id:"default", bands: 0} | |
} | |
} | |
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_unique_orientations(poly): | |
""" | |
Out of all possible rotations and flips, take into account the polygon symmetry and | |
obtain the unique polygon orientations. | |
:param poly: input polygon | |
:return: array of unique settings of (rotation, flip) | |
""" | |
cx, cy = poly.centroid.x, poly.centroid.y | |
pts = np.array(poly.checkers)[:, :-1] | |
checkers = np.array(poly.checkers)[:, -1] |
OlderNewer