partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Attachment.disposition | The content-disposition of the attachment, specifying display style.
Specifies how you would like the attachment to be displayed.
- "inline" results in the attached file being displayed automatically
within the message.
- "attachment" results in the attached file requiring some ac... | sendgrid/helpers/mail/attachment.py | def disposition(self, value):
"""The content-disposition of the attachment, specifying display style.
Specifies how you would like the attachment to be displayed.
- "inline" results in the attached file being displayed automatically
within the message.
- "attachment" resul... | def disposition(self, value):
"""The content-disposition of the attachment, specifying display style.
Specifies how you would like the attachment to be displayed.
- "inline" results in the attached file being displayed automatically
within the message.
- "attachment" resul... | [
"The",
"content",
"-",
"disposition",
"of",
"the",
"attachment",
"specifying",
"display",
"style",
"."
] | sendgrid/sendgrid-python | python | https://github.com/sendgrid/sendgrid-python/blob/266c2abde7a35dfcce263e06bedc6a0bbdebeac9/sendgrid/helpers/mail/attachment.py#L140-L165 | [
"def",
"disposition",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Disposition",
")",
":",
"self",
".",
"_disposition",
"=",
"value",
"else",
":",
"self",
".",
"_disposition",
"=",
"Disposition",
"(",
"value",
")"
] | 266c2abde7a35dfcce263e06bedc6a0bbdebeac9 |
train | Attachment.content_id | The content id for the attachment.
This is used when the disposition is set to "inline" and the attachment
is an image, allowing the file to be displayed within the email body.
:param content_id: The content id for the attachment.
This is used when the Disposition is... | sendgrid/helpers/mail/attachment.py | def content_id(self, value):
"""The content id for the attachment.
This is used when the disposition is set to "inline" and the attachment
is an image, allowing the file to be displayed within the email body.
:param content_id: The content id for the attachment.
... | def content_id(self, value):
"""The content id for the attachment.
This is used when the disposition is set to "inline" and the attachment
is an image, allowing the file to be displayed within the email body.
:param content_id: The content id for the attachment.
... | [
"The",
"content",
"id",
"for",
"the",
"attachment",
"."
] | sendgrid/sendgrid-python | python | https://github.com/sendgrid/sendgrid-python/blob/266c2abde7a35dfcce263e06bedc6a0bbdebeac9/sendgrid/helpers/mail/attachment.py#L179-L194 | [
"def",
"content_id",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"ContentId",
")",
":",
"self",
".",
"_content_id",
"=",
"value",
"else",
":",
"self",
".",
"_content_id",
"=",
"ContentId",
"(",
"value",
")"
] | 266c2abde7a35dfcce263e06bedc6a0bbdebeac9 |
train | Attachment.get | Get a JSON-ready representation of this Attachment.
:returns: This Attachment, ready for use in a request body.
:rtype: dict | sendgrid/helpers/mail/attachment.py | def get(self):
"""
Get a JSON-ready representation of this Attachment.
:returns: This Attachment, ready for use in a request body.
:rtype: dict
"""
attachment = {}
if self.file_content is not None:
attachment["content"] = self.file_content.get()
... | def get(self):
"""
Get a JSON-ready representation of this Attachment.
:returns: This Attachment, ready for use in a request body.
:rtype: dict
"""
attachment = {}
if self.file_content is not None:
attachment["content"] = self.file_content.get()
... | [
"Get",
"a",
"JSON",
"-",
"ready",
"representation",
"of",
"this",
"Attachment",
"."
] | sendgrid/sendgrid-python | python | https://github.com/sendgrid/sendgrid-python/blob/266c2abde7a35dfcce263e06bedc6a0bbdebeac9/sendgrid/helpers/mail/attachment.py#L196-L218 | [
"def",
"get",
"(",
"self",
")",
":",
"attachment",
"=",
"{",
"}",
"if",
"self",
".",
"file_content",
"is",
"not",
"None",
":",
"attachment",
"[",
"\"content\"",
"]",
"=",
"self",
".",
"file_content",
".",
"get",
"(",
")",
"if",
"self",
".",
"file_typ... | 266c2abde7a35dfcce263e06bedc6a0bbdebeac9 |
train | BlobTask.execute | Execute computation of blobs on input eopatch
:param eopatch: Input eopatch
:type eopatch: eolearn.core.EOPatch
:return: EOPatch instance with new key holding the blob image.
:rtype: eolearn.core.EOPatch | features/eolearn/features/blob.py | def execute(self, eopatch):
""" Execute computation of blobs on input eopatch
:param eopatch: Input eopatch
:type eopatch: eolearn.core.EOPatch
:return: EOPatch instance with new key holding the blob image.
:rtype: eolearn.core.EOPatch
"""
for feature_type, featu... | def execute(self, eopatch):
""" Execute computation of blobs on input eopatch
:param eopatch: Input eopatch
:type eopatch: eolearn.core.EOPatch
:return: EOPatch instance with new key holding the blob image.
:rtype: eolearn.core.EOPatch
"""
for feature_type, featu... | [
"Execute",
"computation",
"of",
"blobs",
"on",
"input",
"eopatch"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/features/eolearn/features/blob.py#L80-L92 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
")",
":",
"for",
"feature_type",
",",
"feature_name",
",",
"new_feature_name",
"in",
"self",
".",
"feature",
":",
"eopatch",
"[",
"feature_type",
"]",
"[",
"new_feature_name",
"]",
"=",
"self",
".",
"_compute_bl... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | ImageBaseClassifier._check_classifier | Check if the classifier implements predict and predict_proba methods. | ml_tools/eolearn/ml_tools/classifier.py | def _check_classifier(classifier):
"""
Check if the classifier implements predict and predict_proba methods.
"""
predict = getattr(classifier, "predict", None)
if not callable(predict):
raise ValueError('Classifier does not have predict method!')
pred... | def _check_classifier(classifier):
"""
Check if the classifier implements predict and predict_proba methods.
"""
predict = getattr(classifier, "predict", None)
if not callable(predict):
raise ValueError('Classifier does not have predict method!')
pred... | [
"Check",
"if",
"the",
"classifier",
"implements",
"predict",
"and",
"predict_proba",
"methods",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/classifier.py#L60-L70 | [
"def",
"_check_classifier",
"(",
"classifier",
")",
":",
"predict",
"=",
"getattr",
"(",
"classifier",
",",
"\"predict\"",
",",
"None",
")",
"if",
"not",
"callable",
"(",
"predict",
")",
":",
"raise",
"ValueError",
"(",
"'Classifier does not have predict method!'"... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | ImageBaseClassifier._check_image | Checks the image size and its compatibility with classifier's receptive field.
At this moment it is required that image size = K * receptive_field. This will
be relaxed in future with the introduction of padding. | ml_tools/eolearn/ml_tools/classifier.py | def _check_image(self, X):
"""
Checks the image size and its compatibility with classifier's receptive field.
At this moment it is required that image size = K * receptive_field. This will
be relaxed in future with the introduction of padding.
"""
if (len(X.shap... | def _check_image(self, X):
"""
Checks the image size and its compatibility with classifier's receptive field.
At this moment it is required that image size = K * receptive_field. This will
be relaxed in future with the introduction of padding.
"""
if (len(X.shap... | [
"Checks",
"the",
"image",
"size",
"and",
"its",
"compatibility",
"with",
"classifier",
"s",
"receptive",
"field",
".",
"At",
"this",
"moment",
"it",
"is",
"required",
"that",
"image",
"size",
"=",
"K",
"*",
"receptive_field",
".",
"This",
"will",
"be",
"re... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/classifier.py#L72-L91 | [
"def",
"_check_image",
"(",
"self",
",",
"X",
")",
":",
"if",
"(",
"len",
"(",
"X",
".",
"shape",
")",
"<",
"3",
")",
"or",
"(",
"len",
"(",
"X",
".",
"shape",
")",
">",
"4",
")",
":",
"raise",
"ValueError",
"(",
"'Input has to have shape [n_sample... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | ImagePixelClassifier.image_predict | Predicts class label for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_y, n_pixels_x, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_y, n_pixels_x]
Target labels or masks. | ml_tools/eolearn/ml_tools/classifier.py | def image_predict(self, X):
"""
Predicts class label for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_y, n_pixels_x, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_y, n_p... | def image_predict(self, X):
"""
Predicts class label for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_y, n_pixels_x, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_y, n_p... | [
"Predicts",
"class",
"label",
"for",
"the",
"entire",
"image",
".",
"Parameters",
":",
"-----------",
"X",
":",
"array",
"shape",
"=",
"[",
"n_samples",
"n_pixels_y",
"n_pixels_x",
"n_bands",
"]",
"Array",
"of",
"training",
"images",
"y",
":",
"array",
"shap... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/classifier.py#L148-L172 | [
"def",
"image_predict",
"(",
"self",
",",
"X",
")",
":",
"self",
".",
"_check_image",
"(",
"X",
")",
"new_shape",
"=",
"(",
"X",
".",
"shape",
"[",
"0",
"]",
"*",
"X",
".",
"shape",
"[",
"1",
"]",
"*",
"X",
".",
"shape",
"[",
"2",
"]",
",",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | ImagePixelClassifier.image_predict_proba | Predicts class probabilities for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_x, n_pixels_y, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_x, n_pixels_y, n_classes]
Target pr... | ml_tools/eolearn/ml_tools/classifier.py | def image_predict_proba(self, X):
"""
Predicts class probabilities for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_x, n_pixels_y, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n... | def image_predict_proba(self, X):
"""
Predicts class probabilities for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_x, n_pixels_y, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n... | [
"Predicts",
"class",
"probabilities",
"for",
"the",
"entire",
"image",
".",
"Parameters",
":",
"-----------",
"X",
":",
"array",
"shape",
"=",
"[",
"n_samples",
"n_pixels_x",
"n_pixels_y",
"n_bands",
"]",
"Array",
"of",
"training",
"images",
"y",
":",
"array",... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/classifier.py#L174-L199 | [
"def",
"image_predict_proba",
"(",
"self",
",",
"X",
")",
":",
"self",
".",
"_check_image",
"(",
"X",
")",
"new_shape",
"=",
"(",
"X",
".",
"shape",
"[",
"0",
"]",
"*",
"X",
".",
"shape",
"[",
"1",
"]",
"*",
"X",
".",
"shape",
"[",
"2",
"]",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | ImagePatchClassifier._to_patches | Reshapes input to patches of the size of classifier's receptive field.
For example:
input X shape: [n_samples, n_pixels_y, n_pixels_x, n_bands]
output: [n_samples * n_pixels_y/receptive_field_y * n_pixels_x/receptive_field_x,
receptive_field_y, receptive_field_x, n_ban... | ml_tools/eolearn/ml_tools/classifier.py | def _to_patches(self, X):
"""
Reshapes input to patches of the size of classifier's receptive field.
For example:
input X shape: [n_samples, n_pixels_y, n_pixels_x, n_bands]
output: [n_samples * n_pixels_y/receptive_field_y * n_pixels_x/receptive_field_x,
... | def _to_patches(self, X):
"""
Reshapes input to patches of the size of classifier's receptive field.
For example:
input X shape: [n_samples, n_pixels_y, n_pixels_x, n_bands]
output: [n_samples * n_pixels_y/receptive_field_y * n_pixels_x/receptive_field_x,
... | [
"Reshapes",
"input",
"to",
"patches",
"of",
"the",
"size",
"of",
"classifier",
"s",
"receptive",
"field",
".",
"For",
"example",
":",
"input",
"X",
"shape",
":",
"[",
"n_samples",
"n_pixels_y",
"n_pixels_x",
"n_bands",
"]",
"output",
":",
"[",
"n_samples",
... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/classifier.py#L219-L248 | [
"def",
"_to_patches",
"(",
"self",
",",
"X",
")",
":",
"window",
"=",
"self",
".",
"receptive_field",
"asteps",
"=",
"self",
".",
"receptive_field",
"if",
"len",
"(",
"X",
".",
"shape",
")",
"==",
"4",
":",
"window",
"+=",
"(",
"0",
",",
")",
"aste... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | ImagePatchClassifier.image_predict | Predicts class label for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_y, n_pixels_x, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_y, n_pixels_x]
Target labels or masks. | ml_tools/eolearn/ml_tools/classifier.py | def image_predict(self, X):
"""
Predicts class label for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_y, n_pixels_x, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_y, n_p... | def image_predict(self, X):
"""
Predicts class label for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_y, n_pixels_x, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_y, n_p... | [
"Predicts",
"class",
"label",
"for",
"the",
"entire",
"image",
".",
"Parameters",
":",
"-----------",
"X",
":",
"array",
"shape",
"=",
"[",
"n_samples",
"n_pixels_y",
"n_pixels_x",
"n_bands",
"]",
"Array",
"of",
"training",
"images",
"y",
":",
"array",
"shap... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/classifier.py#L250-L281 | [
"def",
"image_predict",
"(",
"self",
",",
"X",
")",
":",
"self",
".",
"_check_image",
"(",
"X",
")",
"patches",
",",
"patches_shape",
"=",
"self",
".",
"_to_patches",
"(",
"X",
")",
"predictions",
"=",
"self",
".",
"classifier",
".",
"predict",
"(",
"s... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | ImagePatchClassifier.image_predict_proba | Predicts class probabilities for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_x, n_pixels_y, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_x, n_pixels_y, n_classes]
Target pr... | ml_tools/eolearn/ml_tools/classifier.py | def image_predict_proba(self, X):
"""
Predicts class probabilities for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_x, n_pixels_y, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n... | def image_predict_proba(self, X):
"""
Predicts class probabilities for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_x, n_pixels_y, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n... | [
"Predicts",
"class",
"probabilities",
"for",
"the",
"entire",
"image",
".",
"Parameters",
":",
"-----------",
"X",
":",
"array",
"shape",
"=",
"[",
"n_samples",
"n_pixels_x",
"n_pixels_y",
"n_bands",
"]",
"Array",
"of",
"training",
"images",
"y",
":",
"array",... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/classifier.py#L283-L314 | [
"def",
"image_predict_proba",
"(",
"self",
",",
"X",
")",
":",
"self",
".",
"_check_image",
"(",
"X",
")",
"patches",
",",
"patches_shape",
"=",
"self",
".",
"_to_patches",
"(",
"X",
")",
"probabilities",
"=",
"self",
".",
"classifier",
".",
"predict_proba... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | ImagePixel2PatchClassifier._to_patches | Reshapes input to patches of the size of classifier's receptive field.
For example:
input X shape: [n_samples, n_pixels_y, n_pixels_x, n_bands]
output: [n_samples * n_pixels_y/receptive_field_y * n_pixels_x/receptive_field_x,
receptive_field_y, receptive_field_x, n_ban... | ml_tools/eolearn/ml_tools/classifier.py | def _to_patches(self, X):
"""
Reshapes input to patches of the size of classifier's receptive field.
For example:
input X shape: [n_samples, n_pixels_y, n_pixels_x, n_bands]
output: [n_samples * n_pixels_y/receptive_field_y * n_pixels_x/receptive_field_x,
... | def _to_patches(self, X):
"""
Reshapes input to patches of the size of classifier's receptive field.
For example:
input X shape: [n_samples, n_pixels_y, n_pixels_x, n_bands]
output: [n_samples * n_pixels_y/receptive_field_y * n_pixels_x/receptive_field_x,
... | [
"Reshapes",
"input",
"to",
"patches",
"of",
"the",
"size",
"of",
"classifier",
"s",
"receptive",
"field",
".",
"For",
"example",
":",
"input",
"X",
"shape",
":",
"[",
"n_samples",
"n_pixels_y",
"n_pixels_x",
"n_bands",
"]",
"output",
":",
"[",
"n_samples",
... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/classifier.py#L353-L376 | [
"def",
"_to_patches",
"(",
"self",
",",
"X",
")",
":",
"window",
"=",
"self",
".",
"patch_size",
"asteps",
"=",
"self",
".",
"patch_size",
"if",
"len",
"(",
"X",
".",
"shape",
")",
"==",
"4",
":",
"window",
"+=",
"(",
"0",
",",
")",
"asteps",
"+=... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | ImagePixel2PatchClassifier.image_predict | Predicts class label for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_y, n_pixels_x, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_y, n_pixels_x]
Target labels or masks. | ml_tools/eolearn/ml_tools/classifier.py | def image_predict(self, X):
"""
Predicts class label for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_y, n_pixels_x, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_y, n_p... | def image_predict(self, X):
"""
Predicts class label for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_y, n_pixels_x, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_y, n_p... | [
"Predicts",
"class",
"label",
"for",
"the",
"entire",
"image",
".",
"Parameters",
":",
"-----------",
"X",
":",
"array",
"shape",
"=",
"[",
"n_samples",
"n_pixels_y",
"n_pixels_x",
"n_bands",
"]",
"Array",
"of",
"training",
"images",
"y",
":",
"array",
"shap... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/classifier.py#L385-L416 | [
"def",
"image_predict",
"(",
"self",
",",
"X",
")",
":",
"self",
".",
"_check_image",
"(",
"X",
")",
"if",
"self",
".",
"mode",
"==",
"'majority_class'",
":",
"predictions",
"=",
"self",
".",
"pixel_classifier",
".",
"image_predict",
"(",
"X",
")",
"elif... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | ImagePixel2PatchClassifier.image_predict_proba | Predicts class probabilities for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_x, n_pixels_y, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n_pixels_x, n_pixels_y, n_classes]
Target pr... | ml_tools/eolearn/ml_tools/classifier.py | def image_predict_proba(self, X):
"""
Predicts class probabilities for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_x, n_pixels_y, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n... | def image_predict_proba(self, X):
"""
Predicts class probabilities for the entire image.
Parameters:
-----------
X: array, shape = [n_samples, n_pixels_x, n_pixels_y, n_bands]
Array of training images
y: array, shape = [n_samples] or [n_samples, n... | [
"Predicts",
"class",
"probabilities",
"for",
"the",
"entire",
"image",
".",
"Parameters",
":",
"-----------",
"X",
":",
"array",
"shape",
"=",
"[",
"n_samples",
"n_pixels_x",
"n_pixels_y",
"n_bands",
"]",
"Array",
"of",
"training",
"images",
"y",
":",
"array",... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/classifier.py#L418-L447 | [
"def",
"image_predict_proba",
"(",
"self",
",",
"X",
")",
":",
"self",
".",
"_check_image",
"(",
"X",
")",
"probabilities",
"=",
"self",
".",
"pixel_classifier",
".",
"image_predict_proba",
"(",
"X",
")",
"patches",
",",
"_",
"=",
"self",
".",
"_to_patches... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | ImageClassificationMaskTask.execute | Transforms [n, w, h, d] eopatch into a [n, w, h, 1] eopatch, adding it the classification mask.
:param eopatch: An input EOPatch
:type eopatch: EOPatch
:return: Outputs EOPatch with n classification masks appended to out_feature_type with out_feature_name key
:rtype... | ml_tools/eolearn/ml_tools/classifier.py | def execute(self, eopatch):
""" Transforms [n, w, h, d] eopatch into a [n, w, h, 1] eopatch, adding it the classification mask.
:param eopatch: An input EOPatch
:type eopatch: EOPatch
:return: Outputs EOPatch with n classification masks appended to out_feature_type with... | def execute(self, eopatch):
""" Transforms [n, w, h, d] eopatch into a [n, w, h, 1] eopatch, adding it the classification mask.
:param eopatch: An input EOPatch
:type eopatch: EOPatch
:return: Outputs EOPatch with n classification masks appended to out_feature_type with... | [
"Transforms",
"[",
"n",
"w",
"h",
"d",
"]",
"eopatch",
"into",
"a",
"[",
"n",
"w",
"h",
"1",
"]",
"eopatch",
"adding",
"it",
"the",
"classification",
"mask",
".",
":",
"param",
"eopatch",
":",
"An",
"input",
"EOPatch",
":",
"type",
"eopatch",
":",
... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/classifier.py#L472-L485 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
")",
":",
"in_type",
",",
"in_name",
"=",
"next",
"(",
"self",
".",
"input_feature",
"(",
"eopatch",
")",
")",
"out_type",
",",
"out_name",
"=",
"next",
"(",
"self",
".",
"input_feature",
"(",
")",
")",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOExecutor._parse_execution_args | Parses execution arguments provided by user and raises an error if something is wrong | core/eolearn/core/eoexecution.py | def _parse_execution_args(execution_args):
""" Parses execution arguments provided by user and raises an error if something is wrong
"""
if not isinstance(execution_args, (list, tuple)):
raise ValueError("Parameter 'execution_args' should be a list")
return [EOWorkflow.parse... | def _parse_execution_args(execution_args):
""" Parses execution arguments provided by user and raises an error if something is wrong
"""
if not isinstance(execution_args, (list, tuple)):
raise ValueError("Parameter 'execution_args' should be a list")
return [EOWorkflow.parse... | [
"Parses",
"execution",
"arguments",
"provided",
"by",
"user",
"and",
"raises",
"an",
"error",
"if",
"something",
"is",
"wrong"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoexecution.py#L66-L72 | [
"def",
"_parse_execution_args",
"(",
"execution_args",
")",
":",
"if",
"not",
"isinstance",
"(",
"execution_args",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"raise",
"ValueError",
"(",
"\"Parameter 'execution_args' should be a list\"",
")",
"return",
"[",
"EO... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOExecutor.run | Runs the executor with n workers.
:param workers: Number of parallel processes used in the execution. Default is a single process. If set to
`None` the number of workers will be the number of processors of the system.
:type workers: int or None | core/eolearn/core/eoexecution.py | def run(self, workers=1):
""" Runs the executor with n workers.
:param workers: Number of parallel processes used in the execution. Default is a single process. If set to
`None` the number of workers will be the number of processors of the system.
:type workers: int or None
... | def run(self, workers=1):
""" Runs the executor with n workers.
:param workers: Number of parallel processes used in the execution. Default is a single process. If set to
`None` the number of workers will be the number of processors of the system.
:type workers: int or None
... | [
"Runs",
"the",
"executor",
"with",
"n",
"workers",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoexecution.py#L74-L100 | [
"def",
"run",
"(",
"self",
",",
"workers",
"=",
"1",
")",
":",
"self",
".",
"report_folder",
"=",
"self",
".",
"_get_report_folder",
"(",
")",
"if",
"self",
".",
"save_logs",
"and",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
".",
"report_fo... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOExecutor._execute_workflow | Handles a single execution of a workflow | core/eolearn/core/eoexecution.py | def _execute_workflow(cls, process_args):
""" Handles a single execution of a workflow
"""
workflow, input_args, log_path = process_args
if log_path:
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
handler = cls._get_log_handler(log_path)
... | def _execute_workflow(cls, process_args):
""" Handles a single execution of a workflow
"""
workflow, input_args, log_path = process_args
if log_path:
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
handler = cls._get_log_handler(log_path)
... | [
"Handles",
"a",
"single",
"execution",
"of",
"a",
"workflow"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoexecution.py#L103-L125 | [
"def",
"_execute_workflow",
"(",
"cls",
",",
"process_args",
")",
":",
"workflow",
",",
"input_args",
",",
"log_path",
"=",
"process_args",
"if",
"log_path",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
")",
"logger",
".",
"setLevel",
"(",
"logging"... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOExecutor.make_report | Makes a html report and saves it into the same folder where logs are stored. | core/eolearn/core/eoexecution.py | def make_report(self):
""" Makes a html report and saves it into the same folder where logs are stored.
"""
if self.execution_stats is None:
raise RuntimeError('Cannot produce a report without running the executor first, check EOExecutor.run '
'method')... | def make_report(self):
""" Makes a html report and saves it into the same folder where logs are stored.
"""
if self.execution_stats is None:
raise RuntimeError('Cannot produce a report without running the executor first, check EOExecutor.run '
'method')... | [
"Makes",
"a",
"html",
"report",
"and",
"saves",
"it",
"into",
"the",
"same",
"folder",
"where",
"logs",
"are",
"stored",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoexecution.py#L150-L181 | [
"def",
"make_report",
"(",
"self",
")",
":",
"if",
"self",
".",
"execution_stats",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"'Cannot produce a report without running the executor first, check EOExecutor.run '",
"'method'",
")",
"if",
"os",
".",
"environ",
".",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | IndexTracker.onscroll | Action to be taken when an event is triggered.
Event is scroll of the mouse's wheel. This leads to changing the temporal frame displayed.
:param event: Scroll of mouse wheel | core/eolearn/core/plots.py | def onscroll(self, event):
"""Action to be taken when an event is triggered.
Event is scroll of the mouse's wheel. This leads to changing the temporal frame displayed.
:param event: Scroll of mouse wheel
"""
if event.button == 'up':
self.ind = (self.ind + 1)... | def onscroll(self, event):
"""Action to be taken when an event is triggered.
Event is scroll of the mouse's wheel. This leads to changing the temporal frame displayed.
:param event: Scroll of mouse wheel
"""
if event.button == 'up':
self.ind = (self.ind + 1)... | [
"Action",
"to",
"be",
"taken",
"when",
"an",
"event",
"is",
"triggered",
".",
"Event",
"is",
"scroll",
"of",
"the",
"mouse",
"s",
"wheel",
".",
"This",
"leads",
"to",
"changing",
"the",
"temporal",
"frame",
"displayed",
".",
":",
"param",
"event",
":",
... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/plots.py#L43-L54 | [
"def",
"onscroll",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"button",
"==",
"'up'",
":",
"self",
".",
"ind",
"=",
"(",
"self",
".",
"ind",
"+",
"1",
")",
"%",
"self",
".",
"slices",
"else",
":",
"self",
".",
"ind",
"=",
"(",
"... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | IndexTracker.update | Updates image to be displayed with new time frame. | core/eolearn/core/plots.py | def update(self):
"""Updates image to be displayed with new time frame."""
if self.single_channel:
self.im.set_data(self.data[self.ind, :, :])
else:
self.im.set_data(self.data[self.ind, :, :, :])
self.ax.set_ylabel('time frame %s' % self.ind)
self.i... | def update(self):
"""Updates image to be displayed with new time frame."""
if self.single_channel:
self.im.set_data(self.data[self.ind, :, :])
else:
self.im.set_data(self.data[self.ind, :, :, :])
self.ax.set_ylabel('time frame %s' % self.ind)
self.i... | [
"Updates",
"image",
"to",
"be",
"displayed",
"with",
"new",
"time",
"frame",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/plots.py#L56-L63 | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"self",
".",
"single_channel",
":",
"self",
".",
"im",
".",
"set_data",
"(",
"self",
".",
"data",
"[",
"self",
".",
"ind",
",",
":",
",",
":",
"]",
")",
"else",
":",
"self",
".",
"im",
".",
"set_dat... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | PatchShowTask._get_data_to_display | Performs checks on dimensionality of data to makes it suitable for display.
:param eopatch: Input eopatch
:return: Array to display and whether it is single channel or not | core/eolearn/core/plots.py | def _get_data_to_display(self, eopatch):
"""Performs checks on dimensionality of data to makes it suitable for display.
:param eopatch: Input eopatch
:return: Array to display and whether it is single channel or not
"""
feature_type, feature_name = next(self.feature(eopatc... | def _get_data_to_display(self, eopatch):
"""Performs checks on dimensionality of data to makes it suitable for display.
:param eopatch: Input eopatch
:return: Array to display and whether it is single channel or not
"""
feature_type, feature_name = next(self.feature(eopatc... | [
"Performs",
"checks",
"on",
"dimensionality",
"of",
"data",
"to",
"makes",
"it",
"suitable",
"for",
"display",
".",
":",
"param",
"eopatch",
":",
"Input",
"eopatch",
":",
"return",
":",
"Array",
"to",
"display",
"and",
"whether",
"it",
"is",
"single",
"cha... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/plots.py#L86-L117 | [
"def",
"_get_data_to_display",
"(",
"self",
",",
"eopatch",
")",
":",
"feature_type",
",",
"feature_name",
"=",
"next",
"(",
"self",
".",
"feature",
"(",
"eopatch",
")",
")",
"image_seq",
"=",
"eopatch",
"[",
"feature_type",
"]",
"[",
"feature_name",
"]",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | PatchShowTask.execute | Shows data and scrolls through. Currently not working from Jupyter notebooks.
:param eopatch: Image sequence to display. Can be single channel, RGB or multi-channel. If multi-channel,
indices must be specified.
:type eopatch: numpy array
:param title: String to be d... | core/eolearn/core/plots.py | def execute(self, eopatch, title=None, colorbar=False):
"""Shows data and scrolls through. Currently not working from Jupyter notebooks.
:param eopatch: Image sequence to display. Can be single channel, RGB or multi-channel. If multi-channel,
indices must be specified.
... | def execute(self, eopatch, title=None, colorbar=False):
"""Shows data and scrolls through. Currently not working from Jupyter notebooks.
:param eopatch: Image sequence to display. Can be single channel, RGB or multi-channel. If multi-channel,
indices must be specified.
... | [
"Shows",
"data",
"and",
"scrolls",
"through",
".",
"Currently",
"not",
"working",
"from",
"Jupyter",
"notebooks",
".",
":",
"param",
"eopatch",
":",
"Image",
"sequence",
"to",
"display",
".",
"Can",
"be",
"single",
"channel",
"RGB",
"or",
"multi",
"-",
"ch... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/plots.py#L119-L145 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
",",
"title",
"=",
"None",
",",
"colorbar",
"=",
"False",
")",
":",
"image_seq",
",",
"single_channel",
"=",
"self",
".",
"_get_data_to_display",
"(",
"eopatch",
")",
"# clip to positive values\r",
"if",
"image_se... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddSpatioTemporalFeaturesTask.execute | Compute spatio-temporal features for input eopatch
:param eopatch: Input eopatch
:return: eopatch with computed spatio-temporal features | features/eolearn/features/temporal_features.py | def execute(self, eopatch):
""" Compute spatio-temporal features for input eopatch
:param eopatch: Input eopatch
:return: eopatch with computed spatio-temporal features
"""
# pylint: disable=invalid-name
amax_ndvi, amin_ndvi = eopatch.data_timeless[self.argmax_ndvi], eop... | def execute(self, eopatch):
""" Compute spatio-temporal features for input eopatch
:param eopatch: Input eopatch
:return: eopatch with computed spatio-temporal features
"""
# pylint: disable=invalid-name
amax_ndvi, amin_ndvi = eopatch.data_timeless[self.argmax_ndvi], eop... | [
"Compute",
"spatio",
"-",
"temporal",
"features",
"for",
"input",
"eopatch"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/features/eolearn/features/temporal_features.py#L71-L93 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
")",
":",
"# pylint: disable=invalid-name",
"amax_ndvi",
",",
"amin_ndvi",
"=",
"eopatch",
".",
"data_timeless",
"[",
"self",
".",
"argmax_ndvi",
"]",
",",
"eopatch",
".",
"data_timeless",
"[",
"self",
".",
"argmi... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddMaxMinTemporalIndicesTask.execute | Compute argmax/argmin of specified `data_feature` and `data_index`
:param eopatch: Input eopatch
:return: eopatch with added argmax/argmin features | features/eolearn/features/temporal_features.py | def execute(self, eopatch):
""" Compute argmax/argmin of specified `data_feature` and `data_index`
:param eopatch: Input eopatch
:return: eopatch with added argmax/argmin features
"""
if self.mask_data:
valid_data_mask = eopatch.mask['VALID_DATA']
else:
... | def execute(self, eopatch):
""" Compute argmax/argmin of specified `data_feature` and `data_index`
:param eopatch: Input eopatch
:return: eopatch with added argmax/argmin features
"""
if self.mask_data:
valid_data_mask = eopatch.mask['VALID_DATA']
else:
... | [
"Compute",
"argmax",
"/",
"argmin",
"of",
"specified",
"data_feature",
"and",
"data_index"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/features/eolearn/features/temporal_features.py#L127-L159 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
")",
":",
"if",
"self",
".",
"mask_data",
":",
"valid_data_mask",
"=",
"eopatch",
".",
"mask",
"[",
"'VALID_DATA'",
"]",
"else",
":",
"valid_data_mask",
"=",
"eopatch",
".",
"mask",
"[",
"'IS_DATA'",
"]",
"i... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddMaxMinNDVISlopeIndicesTask.execute | Computation of NDVI slope using finite central differences
This implementation loops through every spatial location, considers the valid NDVI values and approximates their
first order derivative using central differences. The argument of min and max is added to the eopatch.
The NDVI slope at d... | features/eolearn/features/temporal_features.py | def execute(self, eopatch):
""" Computation of NDVI slope using finite central differences
This implementation loops through every spatial location, considers the valid NDVI values and approximates their
first order derivative using central differences. The argument of min and max is added to t... | def execute(self, eopatch):
""" Computation of NDVI slope using finite central differences
This implementation loops through every spatial location, considers the valid NDVI values and approximates their
first order derivative using central differences. The argument of min and max is added to t... | [
"Computation",
"of",
"NDVI",
"slope",
"using",
"finite",
"central",
"differences"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/features/eolearn/features/temporal_features.py#L187-L237 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
")",
":",
"# pylint: disable=invalid-name",
"if",
"self",
".",
"mask_data",
":",
"valid_data_mask",
"=",
"eopatch",
".",
"mask",
"[",
"'VALID_DATA'",
"]",
"else",
":",
"valid_data_mask",
"=",
"eopatch",
".",
"mask... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddGeopediaFeature._get_wms_request | Returns WMS request. | io/eolearn/io/geopedia.py | def _get_wms_request(self, bbox, size_x, size_y):
"""
Returns WMS request.
"""
bbox_3857 = transform_bbox(bbox, CRS.POP_WEB)
return GeopediaWmsRequest(layer=self.layer,
theme=self.theme,
bbox=bbox_3857,
... | def _get_wms_request(self, bbox, size_x, size_y):
"""
Returns WMS request.
"""
bbox_3857 = transform_bbox(bbox, CRS.POP_WEB)
return GeopediaWmsRequest(layer=self.layer,
theme=self.theme,
bbox=bbox_3857,
... | [
"Returns",
"WMS",
"request",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/io/eolearn/io/geopedia.py#L46-L58 | [
"def",
"_get_wms_request",
"(",
"self",
",",
"bbox",
",",
"size_x",
",",
"size_y",
")",
":",
"bbox_3857",
"=",
"transform_bbox",
"(",
"bbox",
",",
"CRS",
".",
"POP_WEB",
")",
"return",
"GeopediaWmsRequest",
"(",
"layer",
"=",
"self",
".",
"layer",
",",
"... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddGeopediaFeature._reproject | Reprojects the raster data from Geopedia's CRS (POP_WEB) to EOPatch's CRS. | io/eolearn/io/geopedia.py | def _reproject(self, eopatch, src_raster):
"""
Reprojects the raster data from Geopedia's CRS (POP_WEB) to EOPatch's CRS.
"""
height, width = src_raster.shape
dst_raster = np.ones((height, width), dtype=self.raster_dtype)
src_bbox = transform_bbox(eopatch.bbox, CRS.POP_... | def _reproject(self, eopatch, src_raster):
"""
Reprojects the raster data from Geopedia's CRS (POP_WEB) to EOPatch's CRS.
"""
height, width = src_raster.shape
dst_raster = np.ones((height, width), dtype=self.raster_dtype)
src_bbox = transform_bbox(eopatch.bbox, CRS.POP_... | [
"Reprojects",
"the",
"raster",
"data",
"from",
"Geopedia",
"s",
"CRS",
"(",
"POP_WEB",
")",
"to",
"EOPatch",
"s",
"CRS",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/io/eolearn/io/geopedia.py#L66-L86 | [
"def",
"_reproject",
"(",
"self",
",",
"eopatch",
",",
"src_raster",
")",
":",
"height",
",",
"width",
"=",
"src_raster",
".",
"shape",
"dst_raster",
"=",
"np",
".",
"ones",
"(",
"(",
"height",
",",
"width",
")",
",",
"dtype",
"=",
"self",
".",
"rast... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddGeopediaFeature._map_from_binaries | Each request represents a binary class which will be mapped to the scalar `raster_value` | io/eolearn/io/geopedia.py | def _map_from_binaries(self, eopatch, dst_shape, request_data):
"""
Each request represents a binary class which will be mapped to the scalar `raster_value`
"""
if self.feature_name in eopatch[self.feature_type]:
raster = eopatch[self.feature_type][self.feature_name].squeeze(... | def _map_from_binaries(self, eopatch, dst_shape, request_data):
"""
Each request represents a binary class which will be mapped to the scalar `raster_value`
"""
if self.feature_name in eopatch[self.feature_type]:
raster = eopatch[self.feature_type][self.feature_name].squeeze(... | [
"Each",
"request",
"represents",
"a",
"binary",
"class",
"which",
"will",
"be",
"mapped",
"to",
"the",
"scalar",
"raster_value"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/io/eolearn/io/geopedia.py#L95-L109 | [
"def",
"_map_from_binaries",
"(",
"self",
",",
"eopatch",
",",
"dst_shape",
",",
"request_data",
")",
":",
"if",
"self",
".",
"feature_name",
"in",
"eopatch",
"[",
"self",
".",
"feature_type",
"]",
":",
"raster",
"=",
"eopatch",
"[",
"self",
".",
"feature_... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddGeopediaFeature._map_from_multiclass | `raster_value` is a dictionary specifying the intensity values for each class and the corresponding label value.
A dictionary example for GLC30 LULC mapping is:
raster_value = {'no_data': (0,[0,0,0,0]),
'cultivated land': (1,[193, 243, 249, 255]),
'forest... | io/eolearn/io/geopedia.py | def _map_from_multiclass(self, eopatch, dst_shape, request_data):
"""
`raster_value` is a dictionary specifying the intensity values for each class and the corresponding label value.
A dictionary example for GLC30 LULC mapping is:
raster_value = {'no_data': (0,[0,0,0,0]),
... | def _map_from_multiclass(self, eopatch, dst_shape, request_data):
"""
`raster_value` is a dictionary specifying the intensity values for each class and the corresponding label value.
A dictionary example for GLC30 LULC mapping is:
raster_value = {'no_data': (0,[0,0,0,0]),
... | [
"raster_value",
"is",
"a",
"dictionary",
"specifying",
"the",
"intensity",
"values",
"for",
"each",
"class",
"and",
"the",
"corresponding",
"label",
"value",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/io/eolearn/io/geopedia.py#L111-L134 | [
"def",
"_map_from_multiclass",
"(",
"self",
",",
"eopatch",
",",
"dst_shape",
",",
"request_data",
")",
":",
"raster",
"=",
"np",
".",
"ones",
"(",
"dst_shape",
",",
"dtype",
"=",
"self",
".",
"raster_dtype",
")",
"*",
"self",
".",
"no_data_val",
"for",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddGeopediaFeature.execute | Add requested feature to this existing EOPatch. | io/eolearn/io/geopedia.py | def execute(self, eopatch):
"""
Add requested feature to this existing EOPatch.
"""
data_arr = eopatch[FeatureType.MASK]['IS_DATA']
_, height, width, _ = data_arr.shape
request = self._get_wms_request(eopatch.bbox, width, height)
request_data, = np.asarray(reque... | def execute(self, eopatch):
"""
Add requested feature to this existing EOPatch.
"""
data_arr = eopatch[FeatureType.MASK]['IS_DATA']
_, height, width, _ = data_arr.shape
request = self._get_wms_request(eopatch.bbox, width, height)
request_data, = np.asarray(reque... | [
"Add",
"requested",
"feature",
"to",
"this",
"existing",
"EOPatch",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/io/eolearn/io/geopedia.py#L136-L159 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
")",
":",
"data_arr",
"=",
"eopatch",
"[",
"FeatureType",
".",
"MASK",
"]",
"[",
"'IS_DATA'",
"]",
"_",
",",
"height",
",",
"width",
",",
"_",
"=",
"data_arr",
".",
"shape",
"request",
"=",
"self",
".",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | SentinelHubOGCInput._get_parameter | Collects the parameter either from initialization parameters or from EOPatch | io/eolearn/io/sentinelhub_service.py | def _get_parameter(self, name, eopatch):
""" Collects the parameter either from initialization parameters or from EOPatch
"""
if hasattr(self, name) and getattr(self, name) is not None:
return getattr(self, name)
if name == 'bbox' and eopatch.bbox:
return eopatch.... | def _get_parameter(self, name, eopatch):
""" Collects the parameter either from initialization parameters or from EOPatch
"""
if hasattr(self, name) and getattr(self, name) is not None:
return getattr(self, name)
if name == 'bbox' and eopatch.bbox:
return eopatch.... | [
"Collects",
"the",
"parameter",
"either",
"from",
"initialization",
"parameters",
"or",
"from",
"EOPatch"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/io/eolearn/io/sentinelhub_service.py#L85-L102 | [
"def",
"_get_parameter",
"(",
"self",
",",
"name",
",",
"eopatch",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"name",
")",
"and",
"getattr",
"(",
"self",
",",
"name",
")",
"is",
"not",
"None",
":",
"return",
"getattr",
"(",
"self",
",",
"name",
"... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | SentinelHubOGCInput._prepare_request_data | Collects all parameters used for DataRequest, each one is taken either from initialization parameters or
from EOPatch | io/eolearn/io/sentinelhub_service.py | def _prepare_request_data(self, eopatch, bbox, time_interval):
""" Collects all parameters used for DataRequest, each one is taken either from initialization parameters or
from EOPatch
"""
service_type = ServiceType(self._get_parameter('service_type', eopatch))
if time_interval ... | def _prepare_request_data(self, eopatch, bbox, time_interval):
""" Collects all parameters used for DataRequest, each one is taken either from initialization parameters or
from EOPatch
"""
service_type = ServiceType(self._get_parameter('service_type', eopatch))
if time_interval ... | [
"Collects",
"all",
"parameters",
"used",
"for",
"DataRequest",
"each",
"one",
"is",
"taken",
"either",
"from",
"initialization",
"parameters",
"or",
"from",
"EOPatch"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/io/eolearn/io/sentinelhub_service.py#L104-L128 | [
"def",
"_prepare_request_data",
"(",
"self",
",",
"eopatch",
",",
"bbox",
",",
"time_interval",
")",
":",
"service_type",
"=",
"ServiceType",
"(",
"self",
".",
"_get_parameter",
"(",
"'service_type'",
",",
"eopatch",
")",
")",
"if",
"time_interval",
"is",
"Non... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | SentinelHubOGCInput._add_data | Adds downloaded data to EOPatch | io/eolearn/io/sentinelhub_service.py | def _add_data(self, eopatch, data):
""" Adds downloaded data to EOPatch """
valid_mask = data[..., -1]
data = data[..., :-1]
if data.ndim == 3:
data = data.reshape(data.shape + (1,))
if not self.feature_type.is_time_dependent():
if data.shape[0] > 1:
... | def _add_data(self, eopatch, data):
""" Adds downloaded data to EOPatch """
valid_mask = data[..., -1]
data = data[..., :-1]
if data.ndim == 3:
data = data.reshape(data.shape + (1,))
if not self.feature_type.is_time_dependent():
if data.shape[0] > 1:
... | [
"Adds",
"downloaded",
"data",
"to",
"EOPatch"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/io/eolearn/io/sentinelhub_service.py#L130-L152 | [
"def",
"_add_data",
"(",
"self",
",",
"eopatch",
",",
"data",
")",
":",
"valid_mask",
"=",
"data",
"[",
"...",
",",
"-",
"1",
"]",
"data",
"=",
"data",
"[",
"...",
",",
":",
"-",
"1",
"]",
"if",
"data",
".",
"ndim",
"==",
"3",
":",
"data",
"=... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | SentinelHubOGCInput._add_meta_info | Adds any missing metadata info to EOPatch | io/eolearn/io/sentinelhub_service.py | def _add_meta_info(self, eopatch, request_params, service_type):
""" Adds any missing metadata info to EOPatch """
for param, eoparam in zip(['time', 'time_difference', 'maxcc'], ['time_interval', 'time_difference', 'maxcc']):
if eoparam not in eopatch.meta_info:
eopatch.met... | def _add_meta_info(self, eopatch, request_params, service_type):
""" Adds any missing metadata info to EOPatch """
for param, eoparam in zip(['time', 'time_difference', 'maxcc'], ['time_interval', 'time_difference', 'maxcc']):
if eoparam not in eopatch.meta_info:
eopatch.met... | [
"Adds",
"any",
"missing",
"metadata",
"info",
"to",
"EOPatch"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/io/eolearn/io/sentinelhub_service.py#L154-L169 | [
"def",
"_add_meta_info",
"(",
"self",
",",
"eopatch",
",",
"request_params",
",",
"service_type",
")",
":",
"for",
"param",
",",
"eoparam",
"in",
"zip",
"(",
"[",
"'time'",
",",
"'time_difference'",
",",
"'maxcc'",
"]",
",",
"[",
"'time_interval'",
",",
"'... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | SentinelHubOGCInput.execute | Creates OGC (WMS or WCS) request, downloads requested data and stores it together
with valid data mask in newly created EOPatch. Returns the EOPatch.
:param eopatch:
:type eopatch: EOPatch or None
:param bbox: specifies the bounding box of the requested image. Coordinates must be in
... | io/eolearn/io/sentinelhub_service.py | def execute(self, eopatch=None, bbox=None, time_interval=None):
"""
Creates OGC (WMS or WCS) request, downloads requested data and stores it together
with valid data mask in newly created EOPatch. Returns the EOPatch.
:param eopatch:
:type eopatch: EOPatch or None
:param... | def execute(self, eopatch=None, bbox=None, time_interval=None):
"""
Creates OGC (WMS or WCS) request, downloads requested data and stores it together
with valid data mask in newly created EOPatch. Returns the EOPatch.
:param eopatch:
:type eopatch: EOPatch or None
:param... | [
"Creates",
"OGC",
"(",
"WMS",
"or",
"WCS",
")",
"request",
"downloads",
"requested",
"data",
"and",
"stores",
"it",
"together",
"with",
"valid",
"data",
"mask",
"in",
"newly",
"created",
"EOPatch",
".",
"Returns",
"the",
"EOPatch",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/io/eolearn/io/sentinelhub_service.py#L171-L221 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
"=",
"None",
",",
"bbox",
"=",
"None",
",",
"time_interval",
"=",
"None",
")",
":",
"if",
"eopatch",
"is",
"None",
":",
"eopatch",
"=",
"EOPatch",
"(",
")",
"request_params",
",",
"service_type",
"=",
"sel... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | get_s2_pixel_cloud_detector | Wrapper function for pixel-based S2 cloud detector `S2PixelCloudDetector` | mask/eolearn/mask/cloud_mask.py | def get_s2_pixel_cloud_detector(threshold=0.4, average_over=4, dilation_size=2, all_bands=True):
""" Wrapper function for pixel-based S2 cloud detector `S2PixelCloudDetector`
"""
return S2PixelCloudDetector(threshold=threshold,
average_over=average_over,
... | def get_s2_pixel_cloud_detector(threshold=0.4, average_over=4, dilation_size=2, all_bands=True):
""" Wrapper function for pixel-based S2 cloud detector `S2PixelCloudDetector`
"""
return S2PixelCloudDetector(threshold=threshold,
average_over=average_over,
... | [
"Wrapper",
"function",
"for",
"pixel",
"-",
"based",
"S2",
"cloud",
"detector",
"S2PixelCloudDetector"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/mask/eolearn/mask/cloud_mask.py#L284-L290 | [
"def",
"get_s2_pixel_cloud_detector",
"(",
"threshold",
"=",
"0.4",
",",
"average_over",
"=",
"4",
",",
"dilation_size",
"=",
"2",
",",
"all_bands",
"=",
"True",
")",
":",
"return",
"S2PixelCloudDetector",
"(",
"threshold",
"=",
"threshold",
",",
"average_over",... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddCloudMaskTask._get_wms_request | Returns WMS request. | mask/eolearn/mask/cloud_mask.py | def _get_wms_request(self, bbox, time_interval, size_x, size_y, maxcc, time_difference, custom_url_params):
"""
Returns WMS request.
"""
return WmsRequest(layer=self.data_feature,
bbox=bbox,
time=time_interval,
... | def _get_wms_request(self, bbox, time_interval, size_x, size_y, maxcc, time_difference, custom_url_params):
"""
Returns WMS request.
"""
return WmsRequest(layer=self.data_feature,
bbox=bbox,
time=time_interval,
... | [
"Returns",
"WMS",
"request",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/mask/eolearn/mask/cloud_mask.py#L77-L91 | [
"def",
"_get_wms_request",
"(",
"self",
",",
"bbox",
",",
"time_interval",
",",
"size_x",
",",
"size_y",
",",
"maxcc",
",",
"time_difference",
",",
"custom_url_params",
")",
":",
"return",
"WmsRequest",
"(",
"layer",
"=",
"self",
".",
"data_feature",
",",
"b... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddCloudMaskTask._get_wcs_request | Returns WCS request. | mask/eolearn/mask/cloud_mask.py | def _get_wcs_request(self, bbox, time_interval, size_x, size_y, maxcc, time_difference, custom_url_params):
"""
Returns WCS request.
"""
return WcsRequest(layer=self.data_feature,
bbox=bbox,
time=time_interval,
... | def _get_wcs_request(self, bbox, time_interval, size_x, size_y, maxcc, time_difference, custom_url_params):
"""
Returns WCS request.
"""
return WcsRequest(layer=self.data_feature,
bbox=bbox,
time=time_interval,
... | [
"Returns",
"WCS",
"request",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/mask/eolearn/mask/cloud_mask.py#L93-L106 | [
"def",
"_get_wcs_request",
"(",
"self",
",",
"bbox",
",",
"time_interval",
",",
"size_x",
",",
"size_y",
",",
"maxcc",
",",
"time_difference",
",",
"custom_url_params",
")",
":",
"return",
"WcsRequest",
"(",
"layer",
"=",
"self",
".",
"data_feature",
",",
"b... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddCloudMaskTask._get_rescale_factors | Compute the resampling factor for height and width of the input array
:param reference_shape: Tuple specifying height and width in pixels of high-resolution array
:type reference_shape: tuple of ints
:param meta_info: Meta-info dictionary of input eopatch. Defines OGC request and parameters use... | mask/eolearn/mask/cloud_mask.py | def _get_rescale_factors(self, reference_shape, meta_info):
""" Compute the resampling factor for height and width of the input array
:param reference_shape: Tuple specifying height and width in pixels of high-resolution array
:type reference_shape: tuple of ints
:param meta_info: Meta-... | def _get_rescale_factors(self, reference_shape, meta_info):
""" Compute the resampling factor for height and width of the input array
:param reference_shape: Tuple specifying height and width in pixels of high-resolution array
:type reference_shape: tuple of ints
:param meta_info: Meta-... | [
"Compute",
"the",
"resampling",
"factor",
"for",
"height",
"and",
"width",
"of",
"the",
"input",
"array"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/mask/eolearn/mask/cloud_mask.py#L108-L143 | [
"def",
"_get_rescale_factors",
"(",
"self",
",",
"reference_shape",
",",
"meta_info",
")",
":",
"# Figure out resampling size",
"height",
",",
"width",
"=",
"reference_shape",
"service_type",
"=",
"ServiceType",
"(",
"meta_info",
"[",
"'service_type'",
"]",
")",
"re... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddCloudMaskTask._downscaling | Downscale existing array to resolution requested by cloud detector
:param hr_array: High-resolution data array to be downscaled
:param meta_info: Meta-info of eopatch
:param interp: Interpolation method to be used in downscaling. Default is `'linear'`
:param smooth: Apply Gaussian smoot... | mask/eolearn/mask/cloud_mask.py | def _downscaling(self, hr_array, meta_info, interp='linear', smooth=True):
""" Downscale existing array to resolution requested by cloud detector
:param hr_array: High-resolution data array to be downscaled
:param meta_info: Meta-info of eopatch
:param interp: Interpolation method to be... | def _downscaling(self, hr_array, meta_info, interp='linear', smooth=True):
""" Downscale existing array to resolution requested by cloud detector
:param hr_array: High-resolution data array to be downscaled
:param meta_info: Meta-info of eopatch
:param interp: Interpolation method to be... | [
"Downscale",
"existing",
"array",
"to",
"resolution",
"requested",
"by",
"cloud",
"detector"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/mask/eolearn/mask/cloud_mask.py#L145-L169 | [
"def",
"_downscaling",
"(",
"self",
",",
"hr_array",
",",
"meta_info",
",",
"interp",
"=",
"'linear'",
",",
"smooth",
"=",
"True",
")",
":",
"# Run cloud mask on full resolution",
"if",
"(",
"self",
".",
"cm_size_y",
"is",
"None",
")",
"and",
"(",
"self",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddCloudMaskTask._upsampling | Upsample the low-resolution array to the original high-resolution grid
:param lr_array: Low-resolution array to be upsampled
:param rescale: Rescale factor for rows/columns
:param reference_shape: Original size of high-resolution eopatch. Tuple with dimension for time, height and
... | mask/eolearn/mask/cloud_mask.py | def _upsampling(lr_array, rescale, reference_shape, interp='linear'):
""" Upsample the low-resolution array to the original high-resolution grid
:param lr_array: Low-resolution array to be upsampled
:param rescale: Rescale factor for rows/columns
:param reference_shape: Original size of... | def _upsampling(lr_array, rescale, reference_shape, interp='linear'):
""" Upsample the low-resolution array to the original high-resolution grid
:param lr_array: Low-resolution array to be upsampled
:param rescale: Rescale factor for rows/columns
:param reference_shape: Original size of... | [
"Upsample",
"the",
"low",
"-",
"resolution",
"array",
"to",
"the",
"original",
"high",
"-",
"resolution",
"grid"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/mask/eolearn/mask/cloud_mask.py#L172-L199 | [
"def",
"_upsampling",
"(",
"lr_array",
",",
"rescale",
",",
"reference_shape",
",",
"interp",
"=",
"'linear'",
")",
":",
"hr_shape",
"=",
"reference_shape",
"+",
"(",
"1",
",",
")",
"lr_shape",
"=",
"lr_array",
".",
"shape",
"+",
"(",
"1",
",",
")",
"i... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddCloudMaskTask._make_request | Make OGC request to create input for cloud detector classifier
:param bbox: Bounding box
:param meta_info: Meta-info dictionary of input eopatch
:return: Requested data | mask/eolearn/mask/cloud_mask.py | def _make_request(self, bbox, meta_info, timestamps):
""" Make OGC request to create input for cloud detector classifier
:param bbox: Bounding box
:param meta_info: Meta-info dictionary of input eopatch
:return: Requested data
"""
service_type = ServiceType(meta_info['se... | def _make_request(self, bbox, meta_info, timestamps):
""" Make OGC request to create input for cloud detector classifier
:param bbox: Bounding box
:param meta_info: Meta-info dictionary of input eopatch
:return: Requested data
"""
service_type = ServiceType(meta_info['se... | [
"Make",
"OGC",
"request",
"to",
"create",
"input",
"for",
"cloud",
"detector",
"classifier"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/mask/eolearn/mask/cloud_mask.py#L201-L244 | [
"def",
"_make_request",
"(",
"self",
",",
"bbox",
",",
"meta_info",
",",
"timestamps",
")",
":",
"service_type",
"=",
"ServiceType",
"(",
"meta_info",
"[",
"'service_type'",
"]",
")",
"# Raise error if resolutions are not specified",
"if",
"self",
".",
"cm_size_x",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddCloudMaskTask.execute | Add cloud binary mask and (optionally) cloud probability map to input eopatch
:param eopatch: Input `EOPatch` instance
:return: `EOPatch` with additional cloud maps | mask/eolearn/mask/cloud_mask.py | def execute(self, eopatch):
""" Add cloud binary mask and (optionally) cloud probability map to input eopatch
:param eopatch: Input `EOPatch` instance
:return: `EOPatch` with additional cloud maps
"""
# Downsample or make request
if not eopatch.data:
raise Va... | def execute(self, eopatch):
""" Add cloud binary mask and (optionally) cloud probability map to input eopatch
:param eopatch: Input `EOPatch` instance
:return: `EOPatch` with additional cloud maps
"""
# Downsample or make request
if not eopatch.data:
raise Va... | [
"Add",
"cloud",
"binary",
"mask",
"and",
"(",
"optionally",
")",
"cloud",
"probability",
"map",
"to",
"input",
"eopatch"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/mask/eolearn/mask/cloud_mask.py#L246-L281 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
")",
":",
"# Downsample or make request",
"if",
"not",
"eopatch",
".",
"data",
":",
"raise",
"ValueError",
"(",
"'EOPatch must contain some data feature'",
")",
"if",
"self",
".",
"data_feature",
"in",
"eopatch",
".",... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOTask._execute_handling | Handles measuring execution time and error propagation | core/eolearn/core/eotask.py | def _execute_handling(self, *eopatches, **kwargs):
""" Handles measuring execution time and error propagation
"""
self.private_task_config.start_time = datetime.datetime.now()
caught_exception = None
try:
return_value = self.execute(*eopatches, **kwargs)
... | def _execute_handling(self, *eopatches, **kwargs):
""" Handles measuring execution time and error propagation
"""
self.private_task_config.start_time = datetime.datetime.now()
caught_exception = None
try:
return_value = self.execute(*eopatches, **kwargs)
... | [
"Handles",
"measuring",
"execution",
"time",
"and",
"error",
"propagation"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eotask.py#L59-L76 | [
"def",
"_execute_handling",
"(",
"self",
",",
"*",
"eopatches",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"private_task_config",
".",
"start_time",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"caught_exception",
"=",
"None",
"try",
":",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOTask._parse_features | See eolearn.core.utilities.FeatureParser class. | core/eolearn/core/eotask.py | def _parse_features(features, new_names=False, rename_function=None, default_feature_type=None,
allowed_feature_types=None):
""" See eolearn.core.utilities.FeatureParser class.
"""
return FeatureParser(features, new_names=new_names, rename_function=rename_function,
... | def _parse_features(features, new_names=False, rename_function=None, default_feature_type=None,
allowed_feature_types=None):
""" See eolearn.core.utilities.FeatureParser class.
"""
return FeatureParser(features, new_names=new_names, rename_function=rename_function,
... | [
"See",
"eolearn",
".",
"core",
".",
"utilities",
".",
"FeatureParser",
"class",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eotask.py#L85-L90 | [
"def",
"_parse_features",
"(",
"features",
",",
"new_names",
"=",
"False",
",",
"rename_function",
"=",
"None",
",",
"default_feature_type",
"=",
"None",
",",
"allowed_feature_types",
"=",
"None",
")",
":",
"return",
"FeatureParser",
"(",
"features",
",",
"new_n... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | process_readme | Function which will process README.md file and divide it into INTRO.md and INSTALL.md, which will be used in
documentation | docs/source/conf.py | def process_readme():
""" Function which will process README.md file and divide it into INTRO.md and INSTALL.md, which will be used in
documentation
"""
with open('../../README.md', 'r') as file:
readme = file.read()
readme = readme.replace('# eo-learn', '# Introduction').replace('docs/sour... | def process_readme():
""" Function which will process README.md file and divide it into INTRO.md and INSTALL.md, which will be used in
documentation
"""
with open('../../README.md', 'r') as file:
readme = file.read()
readme = readme.replace('# eo-learn', '# Introduction').replace('docs/sour... | [
"Function",
"which",
"will",
"process",
"README",
".",
"md",
"file",
"and",
"divide",
"it",
"into",
"INTRO",
".",
"md",
"and",
"INSTALL",
".",
"md",
"which",
"will",
"be",
"used",
"in",
"documentation"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/docs/source/conf.py#L221-L249 | [
"def",
"process_readme",
"(",
")",
":",
"with",
"open",
"(",
"'../../README.md'",
",",
"'r'",
")",
"as",
"file",
":",
"readme",
"=",
"file",
".",
"read",
"(",
")",
"readme",
"=",
"readme",
".",
"replace",
"(",
"'# eo-learn'",
",",
"'# Introduction'",
")"... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | get_common_timestamps | Return indices of timestamps from source that are also found in target.
:param source: timestamps from source
:type source: list of datetime objects
:param target: timestamps from target
:type target: list of datetime objects
:return: indices of timestamps from source that are also found in t... | core/eolearn/core/utilities.py | def get_common_timestamps(source, target):
"""Return indices of timestamps from source that are also found in target.
:param source: timestamps from source
:type source: list of datetime objects
:param target: timestamps from target
:type target: list of datetime objects
:return: indices... | def get_common_timestamps(source, target):
"""Return indices of timestamps from source that are also found in target.
:param source: timestamps from source
:type source: list of datetime objects
:param target: timestamps from target
:type target: list of datetime objects
:return: indices... | [
"Return",
"indices",
"of",
"timestamps",
"from",
"source",
"that",
"are",
"also",
"found",
"in",
"target",
".",
":",
"param",
"source",
":",
"timestamps",
"from",
"source",
":",
"type",
"source",
":",
"list",
"of",
"datetime",
"objects",
":",
"param",
"tar... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L325-L337 | [
"def",
"get_common_timestamps",
"(",
"source",
",",
"target",
")",
":",
"remove_from_source",
"=",
"set",
"(",
"source",
")",
".",
"difference",
"(",
"target",
")",
"remove_from_source_idxs",
"=",
"[",
"source",
".",
"index",
"(",
"rm_date",
")",
"for",
"rm_... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | deep_eq | Compares whether fst_obj and snd_obj are deeply equal.
In case when both fst_obj and snd_obj are of type np.ndarray or either np.memmap, they are compared using
np.array_equal(fst_obj, snd_obj). Otherwise, when they are lists or tuples, they are compared for length and then
deep_eq is applied component... | core/eolearn/core/utilities.py | def deep_eq(fst_obj, snd_obj):
"""Compares whether fst_obj and snd_obj are deeply equal.
In case when both fst_obj and snd_obj are of type np.ndarray or either np.memmap, they are compared using
np.array_equal(fst_obj, snd_obj). Otherwise, when they are lists or tuples, they are compared for length and... | def deep_eq(fst_obj, snd_obj):
"""Compares whether fst_obj and snd_obj are deeply equal.
In case when both fst_obj and snd_obj are of type np.ndarray or either np.memmap, they are compared using
np.array_equal(fst_obj, snd_obj). Otherwise, when they are lists or tuples, they are compared for length and... | [
"Compares",
"whether",
"fst_obj",
"and",
"snd_obj",
"are",
"deeply",
"equal",
".",
"In",
"case",
"when",
"both",
"fst_obj",
"and",
"snd_obj",
"are",
"of",
"type",
"np",
".",
"ndarray",
"or",
"either",
"np",
".",
"memmap",
"they",
"are",
"compared",
"using"... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L340-L399 | [
"def",
"deep_eq",
"(",
"fst_obj",
",",
"snd_obj",
")",
":",
"# pylint: disable=too-many-return-statements\r",
"if",
"isinstance",
"(",
"fst_obj",
",",
"(",
"np",
".",
"ndarray",
",",
"np",
".",
"memmap",
")",
")",
":",
"if",
"not",
"isinstance",
"(",
"snd_ob... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | negate_mask | Returns the negated mask.
If elements of input mask have 0 and non-zero values, then the returned matrix will have all elements 0 (1) where
the original one has non-zero (0).
:param mask: Input mask
:type mask: np.array
:return: array of same shape and dtype=int8 as input array
:rtype:... | core/eolearn/core/utilities.py | def negate_mask(mask):
"""Returns the negated mask.
If elements of input mask have 0 and non-zero values, then the returned matrix will have all elements 0 (1) where
the original one has non-zero (0).
:param mask: Input mask
:type mask: np.array
:return: array of same shape and dtype=i... | def negate_mask(mask):
"""Returns the negated mask.
If elements of input mask have 0 and non-zero values, then the returned matrix will have all elements 0 (1) where
the original one has non-zero (0).
:param mask: Input mask
:type mask: np.array
:return: array of same shape and dtype=i... | [
"Returns",
"the",
"negated",
"mask",
".",
"If",
"elements",
"of",
"input",
"mask",
"have",
"0",
"and",
"non",
"-",
"zero",
"values",
"then",
"the",
"returned",
"matrix",
"will",
"have",
"all",
"elements",
"0",
"(",
"1",
")",
"where",
"the",
"original",
... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L402-L416 | [
"def",
"negate_mask",
"(",
"mask",
")",
":",
"res",
"=",
"np",
".",
"ones",
"(",
"mask",
".",
"shape",
",",
"dtype",
"=",
"np",
".",
"int8",
")",
"res",
"[",
"mask",
">",
"0",
"]",
"=",
"0",
"return",
"res"
] | b8c390b9f553c561612fe9eb64e720611633a035 |
train | constant_pad | Function pads an image of shape (rows, columns, channels) with zeros.
It pads an image so that the shape becomes (rows + padded_rows, columns + padded_columns, channels), where
padded_rows = (int(rows/multiple_of[0]) + 1) * multiple_of[0] - rows
Same rule is applied to columns.
:type X: array ... | core/eolearn/core/utilities.py | def constant_pad(X, multiple_of, up_down_rule='even', left_right_rule='even', pad_value=0):
"""Function pads an image of shape (rows, columns, channels) with zeros.
It pads an image so that the shape becomes (rows + padded_rows, columns + padded_columns, channels), where
padded_rows = (int(rows/multipl... | def constant_pad(X, multiple_of, up_down_rule='even', left_right_rule='even', pad_value=0):
"""Function pads an image of shape (rows, columns, channels) with zeros.
It pads an image so that the shape becomes (rows + padded_rows, columns + padded_columns, channels), where
padded_rows = (int(rows/multipl... | [
"Function",
"pads",
"an",
"image",
"of",
"shape",
"(",
"rows",
"columns",
"channels",
")",
"with",
"zeros",
".",
"It",
"pads",
"an",
"image",
"so",
"that",
"the",
"shape",
"becomes",
"(",
"rows",
"+",
"padded_rows",
"columns",
"+",
"padded_columns",
"chann... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L419-L473 | [
"def",
"constant_pad",
"(",
"X",
",",
"multiple_of",
",",
"up_down_rule",
"=",
"'even'",
",",
"left_right_rule",
"=",
"'even'",
",",
"pad_value",
"=",
"0",
")",
":",
"# pylint: disable=invalid-name\r",
"shape",
"=",
"X",
".",
"shape",
"row_padding",
",",
"col_... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._parse_features | Takes a collection of features structured in a various ways and parses them into one way.
If input format is not recognized it raises an error.
:return: A collection of features
:rtype: collections.OrderedDict(FeatureType: collections.OrderedDict(str: str or Ellipsis) or Ellipsis)
... | core/eolearn/core/utilities.py | def _parse_features(features, new_names):
"""Takes a collection of features structured in a various ways and parses them into one way.
If input format is not recognized it raises an error.
:return: A collection of features
:rtype: collections.OrderedDict(FeatureType: collections.... | def _parse_features(features, new_names):
"""Takes a collection of features structured in a various ways and parses them into one way.
If input format is not recognized it raises an error.
:return: A collection of features
:rtype: collections.OrderedDict(FeatureType: collections.... | [
"Takes",
"a",
"collection",
"of",
"features",
"structured",
"in",
"a",
"various",
"ways",
"and",
"parses",
"them",
"into",
"one",
"way",
".",
"If",
"input",
"format",
"is",
"not",
"recognized",
"it",
"raises",
"an",
"error",
".",
":",
"return",
":",
"A",... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L104-L131 | [
"def",
"_parse_features",
"(",
"features",
",",
"new_names",
")",
":",
"if",
"isinstance",
"(",
"features",
",",
"dict",
")",
":",
"return",
"FeatureParser",
".",
"_parse_dict",
"(",
"features",
",",
"new_names",
")",
"if",
"isinstance",
"(",
"features",
","... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._parse_dict | Helping function of `_parse_features` that parses a list. | core/eolearn/core/utilities.py | def _parse_dict(features, new_names):
"""Helping function of `_parse_features` that parses a list."""
feature_collection = OrderedDict()
for feature_type, feature_names in features.items():
try:
feature_type = FeatureType(feature_type)
except ValueEr... | def _parse_dict(features, new_names):
"""Helping function of `_parse_features` that parses a list."""
feature_collection = OrderedDict()
for feature_type, feature_names in features.items():
try:
feature_type = FeatureType(feature_type)
except ValueEr... | [
"Helping",
"function",
"of",
"_parse_features",
"that",
"parses",
"a",
"list",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L134-L152 | [
"def",
"_parse_dict",
"(",
"features",
",",
"new_names",
")",
":",
"feature_collection",
"=",
"OrderedDict",
"(",
")",
"for",
"feature_type",
",",
"feature_names",
"in",
"features",
".",
"items",
"(",
")",
":",
"try",
":",
"feature_type",
"=",
"FeatureType",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._parse_list | Helping function of `_parse_features` that parses a list. | core/eolearn/core/utilities.py | def _parse_list(features, new_names):
"""Helping function of `_parse_features` that parses a list."""
feature_collection = OrderedDict()
for feature in features:
if isinstance(feature, FeatureType):
feature_collection[feature] = ...
elif isinstance... | def _parse_list(features, new_names):
"""Helping function of `_parse_features` that parses a list."""
feature_collection = OrderedDict()
for feature in features:
if isinstance(feature, FeatureType):
feature_collection[feature] = ...
elif isinstance... | [
"Helping",
"function",
"of",
"_parse_features",
"that",
"parses",
"a",
"list",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L155-L173 | [
"def",
"_parse_list",
"(",
"features",
",",
"new_names",
")",
":",
"feature_collection",
"=",
"OrderedDict",
"(",
")",
"for",
"feature",
"in",
"features",
":",
"if",
"isinstance",
"(",
"feature",
",",
"FeatureType",
")",
":",
"feature_collection",
"[",
"featur... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._parse_tuple | Helping function of `_parse_features` that parses a tuple. | core/eolearn/core/utilities.py | def _parse_tuple(features, new_names):
"""Helping function of `_parse_features` that parses a tuple."""
name_idx = 1
try:
feature_type = FeatureType(features[0])
except ValueError:
feature_type = None
name_idx = 0
if feature_type and ... | def _parse_tuple(features, new_names):
"""Helping function of `_parse_features` that parses a tuple."""
name_idx = 1
try:
feature_type = FeatureType(features[0])
except ValueError:
feature_type = None
name_idx = 0
if feature_type and ... | [
"Helping",
"function",
"of",
"_parse_features",
"that",
"parses",
"a",
"tuple",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L176-L187 | [
"def",
"_parse_tuple",
"(",
"features",
",",
"new_names",
")",
":",
"name_idx",
"=",
"1",
"try",
":",
"feature_type",
"=",
"FeatureType",
"(",
"features",
"[",
"0",
"]",
")",
"except",
"ValueError",
":",
"feature_type",
"=",
"None",
"name_idx",
"=",
"0",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._parse_feature_names | Helping function of `_parse_features` that parses a collection of feature names. | core/eolearn/core/utilities.py | def _parse_feature_names(feature_names, new_names):
"""Helping function of `_parse_features` that parses a collection of feature names."""
if isinstance(feature_names, set):
return FeatureParser._parse_names_set(feature_names)
if isinstance(feature_names, dict):
re... | def _parse_feature_names(feature_names, new_names):
"""Helping function of `_parse_features` that parses a collection of feature names."""
if isinstance(feature_names, set):
return FeatureParser._parse_names_set(feature_names)
if isinstance(feature_names, dict):
re... | [
"Helping",
"function",
"of",
"_parse_features",
"that",
"parses",
"a",
"collection",
"of",
"feature",
"names",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L190-L201 | [
"def",
"_parse_feature_names",
"(",
"feature_names",
",",
"new_names",
")",
":",
"if",
"isinstance",
"(",
"feature_names",
",",
"set",
")",
":",
"return",
"FeatureParser",
".",
"_parse_names_set",
"(",
"feature_names",
")",
"if",
"isinstance",
"(",
"feature_names"... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._parse_names_set | Helping function of `_parse_feature_names` that parses a set of feature names. | core/eolearn/core/utilities.py | def _parse_names_set(feature_names):
"""Helping function of `_parse_feature_names` that parses a set of feature names."""
feature_collection = OrderedDict()
for feature_name in feature_names:
if isinstance(feature_name, str):
feature_collection[feature_name] = ..... | def _parse_names_set(feature_names):
"""Helping function of `_parse_feature_names` that parses a set of feature names."""
feature_collection = OrderedDict()
for feature_name in feature_names:
if isinstance(feature_name, str):
feature_collection[feature_name] = ..... | [
"Helping",
"function",
"of",
"_parse_feature_names",
"that",
"parses",
"a",
"set",
"of",
"feature",
"names",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L204-L212 | [
"def",
"_parse_names_set",
"(",
"feature_names",
")",
":",
"feature_collection",
"=",
"OrderedDict",
"(",
")",
"for",
"feature_name",
"in",
"feature_names",
":",
"if",
"isinstance",
"(",
"feature_name",
",",
"str",
")",
":",
"feature_collection",
"[",
"feature_nam... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._parse_names_dict | Helping function of `_parse_feature_names` that parses a dictionary of feature names. | core/eolearn/core/utilities.py | def _parse_names_dict(feature_names):
"""Helping function of `_parse_feature_names` that parses a dictionary of feature names."""
feature_collection = OrderedDict()
for feature_name, new_feature_name in feature_names.items():
if isinstance(feature_name, str) and (isinstance(new_f... | def _parse_names_dict(feature_names):
"""Helping function of `_parse_feature_names` that parses a dictionary of feature names."""
feature_collection = OrderedDict()
for feature_name, new_feature_name in feature_names.items():
if isinstance(feature_name, str) and (isinstance(new_f... | [
"Helping",
"function",
"of",
"_parse_feature_names",
"that",
"parses",
"a",
"dictionary",
"of",
"feature",
"names",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L215-L227 | [
"def",
"_parse_names_dict",
"(",
"feature_names",
")",
":",
"feature_collection",
"=",
"OrderedDict",
"(",
")",
"for",
"feature_name",
",",
"new_feature_name",
"in",
"feature_names",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"feature_name",
",",
"str... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._parse_names_tuple | Helping function of `_parse_feature_names` that parses a tuple or a list of feature names. | core/eolearn/core/utilities.py | def _parse_names_tuple(feature_names, new_names):
"""Helping function of `_parse_feature_names` that parses a tuple or a list of feature names."""
for feature in feature_names:
if not isinstance(feature, str) and feature is not ...:
raise ValueError('Failed to parse {}, e... | def _parse_names_tuple(feature_names, new_names):
"""Helping function of `_parse_feature_names` that parses a tuple or a list of feature names."""
for feature in feature_names:
if not isinstance(feature, str) and feature is not ...:
raise ValueError('Failed to parse {}, e... | [
"Helping",
"function",
"of",
"_parse_feature_names",
"that",
"parses",
"a",
"tuple",
"or",
"a",
"list",
"of",
"feature",
"names",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L230-L248 | [
"def",
"_parse_names_tuple",
"(",
"feature_names",
",",
"new_names",
")",
":",
"for",
"feature",
"in",
"feature_names",
":",
"if",
"not",
"isinstance",
"(",
"feature",
",",
"str",
")",
"and",
"feature",
"is",
"not",
"...",
":",
"raise",
"ValueError",
"(",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._check_feature_types | Checks that feature types are a subset of allowed feature types. (`None` is handled
:raises: ValueError | core/eolearn/core/utilities.py | def _check_feature_types(self):
""" Checks that feature types are a subset of allowed feature types. (`None` is handled
:raises: ValueError
"""
if self.default_feature_type is not None and self.default_feature_type not in self.allowed_feature_types:
raise ValueError('D... | def _check_feature_types(self):
""" Checks that feature types are a subset of allowed feature types. (`None` is handled
:raises: ValueError
"""
if self.default_feature_type is not None and self.default_feature_type not in self.allowed_feature_types:
raise ValueError('D... | [
"Checks",
"that",
"feature",
"types",
"are",
"a",
"subset",
"of",
"allowed",
"feature",
"types",
".",
"(",
"None",
"is",
"handled",
":",
"raises",
":",
"ValueError"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L250-L261 | [
"def",
"_check_feature_types",
"(",
"self",
")",
":",
"if",
"self",
".",
"default_feature_type",
"is",
"not",
"None",
"and",
"self",
".",
"default_feature_type",
"not",
"in",
"self",
".",
"allowed_feature_types",
":",
"raise",
"ValueError",
"(",
"'Default feature ... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._get_features | A generator of parsed features.
:param eopatch: A given EOPatch
:type eopatch: EOPatch or None
:return: One by one feature
:rtype: tuple(FeatureType, str) or tuple(FeatureType, str, str) | core/eolearn/core/utilities.py | def _get_features(self, eopatch=None):
"""A generator of parsed features.
:param eopatch: A given EOPatch
:type eopatch: EOPatch or None
:return: One by one feature
:rtype: tuple(FeatureType, str) or tuple(FeatureType, str, str)
"""
for feature_type, feat... | def _get_features(self, eopatch=None):
"""A generator of parsed features.
:param eopatch: A given EOPatch
:type eopatch: EOPatch or None
:return: One by one feature
:rtype: tuple(FeatureType, str) or tuple(FeatureType, str, str)
"""
for feature_type, feat... | [
"A",
"generator",
"of",
"parsed",
"features",
".",
":",
"param",
"eopatch",
":",
"A",
"given",
"EOPatch",
":",
"type",
"eopatch",
":",
"EOPatch",
"or",
"None",
":",
"return",
":",
"One",
"by",
"one",
"feature",
":",
"rtype",
":",
"tuple",
"(",
"Feature... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L263-L298 | [
"def",
"_get_features",
"(",
"self",
",",
"eopatch",
"=",
"None",
")",
":",
"for",
"feature_type",
",",
"feature_dict",
"in",
"self",
".",
"feature_collection",
".",
"items",
"(",
")",
":",
"if",
"feature_type",
"is",
"None",
"and",
"self",
".",
"default_f... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._find_feature_type | Iterates over allowed feature types of given EOPatch and tries to find a feature type for which there
exists a feature with given name
:return: A feature type or `None` if such feature type does not exist
:rtype: FeatureType or None | core/eolearn/core/utilities.py | def _find_feature_type(self, feature_name, eopatch):
""" Iterates over allowed feature types of given EOPatch and tries to find a feature type for which there
exists a feature with given name
:return: A feature type or `None` if such feature type does not exist
:rtype: FeatureType ... | def _find_feature_type(self, feature_name, eopatch):
""" Iterates over allowed feature types of given EOPatch and tries to find a feature type for which there
exists a feature with given name
:return: A feature type or `None` if such feature type does not exist
:rtype: FeatureType ... | [
"Iterates",
"over",
"allowed",
"feature",
"types",
"of",
"given",
"EOPatch",
"and",
"tries",
"to",
"find",
"a",
"feature",
"type",
"for",
"which",
"there",
"exists",
"a",
"feature",
"with",
"given",
"name",
":",
"return",
":",
"A",
"feature",
"type",
"or",... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L300-L310 | [
"def",
"_find_feature_type",
"(",
"self",
",",
"feature_name",
",",
"eopatch",
")",
":",
"for",
"feature_type",
"in",
"self",
".",
"allowed_feature_types",
":",
"if",
"feature_type",
".",
"has_dict",
"(",
")",
"and",
"feature_name",
"in",
"eopatch",
"[",
"feat... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureParser._return_feature | Helping function of `get_features` | core/eolearn/core/utilities.py | def _return_feature(self, feature_type, feature_name, new_feature_name=...):
""" Helping function of `get_features`
"""
if self.new_names:
return feature_type, feature_name, (self.rename_function(feature_name) if new_feature_name is ... else
... | def _return_feature(self, feature_type, feature_name, new_feature_name=...):
""" Helping function of `get_features`
"""
if self.new_names:
return feature_type, feature_name, (self.rename_function(feature_name) if new_feature_name is ... else
... | [
"Helping",
"function",
"of",
"get_features"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L312-L318 | [
"def",
"_return_feature",
"(",
"self",
",",
"feature_type",
",",
"feature_name",
",",
"new_feature_name",
"=",
"...",
")",
":",
"if",
"self",
".",
"new_names",
":",
"return",
"feature_type",
",",
"feature_name",
",",
"(",
"self",
".",
"rename_function",
"(",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow._parse_dependencies | Parses dependencies and adds names of task_names.
:param dependencies: Input of dependency parameter
:type dependencies: list(tuple or Dependency)
:param task_names: Human-readable names of tasks
:type task_names: dict(EOTask: str) or None
:return: List of dependencies
... | core/eolearn/core/eoworkflow.py | def _parse_dependencies(dependencies, task_names):
"""Parses dependencies and adds names of task_names.
:param dependencies: Input of dependency parameter
:type dependencies: list(tuple or Dependency)
:param task_names: Human-readable names of tasks
:type task_names: dict(... | def _parse_dependencies(dependencies, task_names):
"""Parses dependencies and adds names of task_names.
:param dependencies: Input of dependency parameter
:type dependencies: list(tuple or Dependency)
:param task_names: Human-readable names of tasks
:type task_names: dict(... | [
"Parses",
"dependencies",
"and",
"adds",
"names",
"of",
"task_names",
".",
":",
"param",
"dependencies",
":",
"Input",
"of",
"dependency",
"parameter",
":",
"type",
"dependencies",
":",
"list",
"(",
"tuple",
"or",
"Dependency",
")",
":",
"param",
"task_names",... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L54-L68 | [
"def",
"_parse_dependencies",
"(",
"dependencies",
",",
"task_names",
")",
":",
"parsed_dependencies",
"=",
"[",
"dep",
"if",
"isinstance",
"(",
"dep",
",",
"Dependency",
")",
"else",
"Dependency",
"(",
"*",
"dep",
")",
"for",
"dep",
"in",
"dependencies",
"]... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow._set_task_uuid | Adds universally unique user ids (UUID) to each task of the workflow.
:param dependencies: The list of dependencies between tasks defining the computational graph
:type dependencies: list(Dependency)
:return: A dictionary mapping UUID to dependencies
:rtype: dict(str: Dependency) | core/eolearn/core/eoworkflow.py | def _set_task_uuid(self, dependencies):
"""Adds universally unique user ids (UUID) to each task of the workflow.
:param dependencies: The list of dependencies between tasks defining the computational graph
:type dependencies: list(Dependency)
:return: A dictionary mapping UUID to d... | def _set_task_uuid(self, dependencies):
"""Adds universally unique user ids (UUID) to each task of the workflow.
:param dependencies: The list of dependencies between tasks defining the computational graph
:type dependencies: list(Dependency)
:return: A dictionary mapping UUID to d... | [
"Adds",
"universally",
"unique",
"user",
"ids",
"(",
"UUID",
")",
"to",
"each",
"task",
"of",
"the",
"workflow",
".",
":",
"param",
"dependencies",
":",
"The",
"list",
"of",
"dependencies",
"between",
"tasks",
"defining",
"the",
"computational",
"graph",
":"... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L70-L87 | [
"def",
"_set_task_uuid",
"(",
"self",
",",
"dependencies",
")",
":",
"uuid_dict",
"=",
"{",
"}",
"for",
"dep",
"in",
"dependencies",
":",
"task",
"=",
"dep",
".",
"task",
"if",
"task",
".",
"private_task_config",
".",
"uuid",
"in",
"uuid_dict",
":",
"rai... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow.create_dag | Creates a directed graph from dependencies.
:param dependencies: A list of Dependency objects
:type dependencies: list(Dependency)
:return: A directed graph of the workflow
:rtype: DirectedGraph | core/eolearn/core/eoworkflow.py | def create_dag(self, dependencies):
"""Creates a directed graph from dependencies.
:param dependencies: A list of Dependency objects
:type dependencies: list(Dependency)
:return: A directed graph of the workflow
:rtype: DirectedGraph
"""
dag = DirectedGra... | def create_dag(self, dependencies):
"""Creates a directed graph from dependencies.
:param dependencies: A list of Dependency objects
:type dependencies: list(Dependency)
:return: A directed graph of the workflow
:rtype: DirectedGraph
"""
dag = DirectedGra... | [
"Creates",
"a",
"directed",
"graph",
"from",
"dependencies",
".",
":",
"param",
"dependencies",
":",
"A",
"list",
"of",
"Dependency",
"objects",
":",
"type",
"dependencies",
":",
"list",
"(",
"Dependency",
")",
":",
"return",
":",
"A",
"directed",
"graph",
... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L89-L107 | [
"def",
"create_dag",
"(",
"self",
",",
"dependencies",
")",
":",
"dag",
"=",
"DirectedGraph",
"(",
")",
"for",
"dep",
"in",
"dependencies",
":",
"for",
"vertex",
"in",
"dep",
".",
"inputs",
":",
"task_uuid",
"=",
"vertex",
".",
"private_task_config",
".",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow._schedule_dependencies | Computes an ordering < of tasks so that for any two tasks t and t' we have that if t depends on t' then
t' < t. In words, all dependencies of a task precede the task in this ordering.
:param dag: A directed acyclic graph representing dependencies between tasks.
:type dag: DirectedGraph
... | core/eolearn/core/eoworkflow.py | def _schedule_dependencies(dag):
"""
Computes an ordering < of tasks so that for any two tasks t and t' we have that if t depends on t' then
t' < t. In words, all dependencies of a task precede the task in this ordering.
:param dag: A directed acyclic graph representing dependencie... | def _schedule_dependencies(dag):
"""
Computes an ordering < of tasks so that for any two tasks t and t' we have that if t depends on t' then
t' < t. In words, all dependencies of a task precede the task in this ordering.
:param dag: A directed acyclic graph representing dependencie... | [
"Computes",
"an",
"ordering",
"<",
"of",
"tasks",
"so",
"that",
"for",
"any",
"two",
"tasks",
"t",
"and",
"t",
"we",
"have",
"that",
"if",
"t",
"depends",
"on",
"t",
"then",
"t",
"<",
"t",
".",
"In",
"words",
"all",
"dependencies",
"of",
"a",
"task... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L110-L136 | [
"def",
"_schedule_dependencies",
"(",
"dag",
")",
":",
"in_degrees",
"=",
"dict",
"(",
"dag",
".",
"get_indegrees",
"(",
")",
")",
"independent_vertices",
"=",
"collections",
".",
"deque",
"(",
"[",
"vertex",
"for",
"vertex",
"in",
"dag",
"if",
"dag",
".",... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow.make_linear_workflow | Factory method for creating linear workflows.
:param tasks: EOTask's t1,t2,...,tk with dependencies t1->t2->...->tk
:param kwargs: Optional keyword arguments (such as workflow name) forwarded to the constructor
:return: A new EO workflow instance
:rtype: EOWorkflow | core/eolearn/core/eoworkflow.py | def make_linear_workflow(*tasks, **kwargs):
"""Factory method for creating linear workflows.
:param tasks: EOTask's t1,t2,...,tk with dependencies t1->t2->...->tk
:param kwargs: Optional keyword arguments (such as workflow name) forwarded to the constructor
:return: A new EO workfl... | def make_linear_workflow(*tasks, **kwargs):
"""Factory method for creating linear workflows.
:param tasks: EOTask's t1,t2,...,tk with dependencies t1->t2->...->tk
:param kwargs: Optional keyword arguments (such as workflow name) forwarded to the constructor
:return: A new EO workfl... | [
"Factory",
"method",
"for",
"creating",
"linear",
"workflows",
".",
":",
"param",
"tasks",
":",
"EOTask",
"s",
"t1",
"t2",
"...",
"tk",
"with",
"dependencies",
"t1",
"-",
">",
"t2",
"-",
">",
"...",
"-",
">",
"tk",
":",
"param",
"kwargs",
":",
"Optio... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L139-L150 | [
"def",
"make_linear_workflow",
"(",
"*",
"tasks",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Method 'make_linear_workflow' will soon be removed. Use LinearWorkflow class instead\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"r... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow.execute | Executes the workflow.
:param input_args: External input arguments to the workflow. They have to be in a form of a dictionary where
each key is an EOTask used in the workflow and each value is a dictionary or a tuple of arguments.
:type input_args: dict(EOTask: dict(str: object) or tupl... | core/eolearn/core/eoworkflow.py | def execute(self, input_args=None, monitor=False):
"""Executes the workflow.
:param input_args: External input arguments to the workflow. They have to be in a form of a dictionary where
each key is an EOTask used in the workflow and each value is a dictionary or a tuple of arguments.
... | def execute(self, input_args=None, monitor=False):
"""Executes the workflow.
:param input_args: External input arguments to the workflow. They have to be in a form of a dictionary where
each key is an EOTask used in the workflow and each value is a dictionary or a tuple of arguments.
... | [
"Executes",
"the",
"workflow",
".",
":",
"param",
"input_args",
":",
"External",
"input",
"arguments",
"to",
"the",
"workflow",
".",
"They",
"have",
"to",
"be",
"in",
"a",
"form",
"of",
"a",
"dictionary",
"where",
"each",
"key",
"is",
"an",
"EOTask",
"us... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L152-L169 | [
"def",
"execute",
"(",
"self",
",",
"input_args",
"=",
"None",
",",
"monitor",
"=",
"False",
")",
":",
"out_degs",
"=",
"dict",
"(",
"self",
".",
"dag",
".",
"get_outdegrees",
"(",
")",
")",
"input_args",
"=",
"self",
".",
"parse_input_args",
"(",
"inp... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow.parse_input_args | Parses EOWorkflow input arguments provided by user and raises an error if something is wrong. This is
done automatically in the process of workflow execution | core/eolearn/core/eoworkflow.py | def parse_input_args(input_args):
""" Parses EOWorkflow input arguments provided by user and raises an error if something is wrong. This is
done automatically in the process of workflow execution
"""
input_args = input_args if input_args else {}
for task, args in input_args.... | def parse_input_args(input_args):
""" Parses EOWorkflow input arguments provided by user and raises an error if something is wrong. This is
done automatically in the process of workflow execution
"""
input_args = input_args if input_args else {}
for task, args in input_args.... | [
"Parses",
"EOWorkflow",
"input",
"arguments",
"provided",
"by",
"user",
"and",
"raises",
"an",
"error",
"if",
"something",
"is",
"wrong",
".",
"This",
"is",
"done",
"automatically",
"in",
"the",
"process",
"of",
"workflow",
"execution"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L172-L185 | [
"def",
"parse_input_args",
"(",
"input_args",
")",
":",
"input_args",
"=",
"input_args",
"if",
"input_args",
"else",
"{",
"}",
"for",
"task",
",",
"args",
"in",
"input_args",
".",
"items",
"(",
")",
":",
"if",
"not",
"isinstance",
"(",
"task",
",",
"EOTa... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow._execute_tasks | Executes tasks comprising the workflow in the predetermined order.
:param input_args: External input arguments to the workflow.
:type input_args: Dict
:param out_degs: Dictionary mapping vertices (task IDs) to their out-degrees. (The out-degree equals the number
of tasks that depen... | core/eolearn/core/eoworkflow.py | def _execute_tasks(self, *, input_args, out_degs, monitor):
"""Executes tasks comprising the workflow in the predetermined order.
:param input_args: External input arguments to the workflow.
:type input_args: Dict
:param out_degs: Dictionary mapping vertices (task IDs) to their out... | def _execute_tasks(self, *, input_args, out_degs, monitor):
"""Executes tasks comprising the workflow in the predetermined order.
:param input_args: External input arguments to the workflow.
:type input_args: Dict
:param out_degs: Dictionary mapping vertices (task IDs) to their out... | [
"Executes",
"tasks",
"comprising",
"the",
"workflow",
"in",
"the",
"predetermined",
"order",
".",
":",
"param",
"input_args",
":",
"External",
"input",
"arguments",
"to",
"the",
"workflow",
".",
":",
"type",
"input_args",
":",
"Dict",
":",
"param",
"out_degs",... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L187-L214 | [
"def",
"_execute_tasks",
"(",
"self",
",",
"*",
",",
"input_args",
",",
"out_degs",
",",
"monitor",
")",
":",
"done_tasks",
"=",
"set",
"(",
")",
"intermediate_results",
"=",
"{",
"}",
"for",
"dep",
"in",
"self",
".",
"ordered_dependencies",
":",
"result",... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow._execute_task | Executes a task of the workflow.
:param dependency: A workflow dependency
:type dependency: Dependency
:param input_args: External task parameters.
:type input_args: dict
:param intermediate_results: The dictionary containing intermediate results, including the results of ... | core/eolearn/core/eoworkflow.py | def _execute_task(self, *, dependency, input_args, intermediate_results, monitor):
"""Executes a task of the workflow.
:param dependency: A workflow dependency
:type dependency: Dependency
:param input_args: External task parameters.
:type input_args: dict
:param ... | def _execute_task(self, *, dependency, input_args, intermediate_results, monitor):
"""Executes a task of the workflow.
:param dependency: A workflow dependency
:type dependency: Dependency
:param input_args: External task parameters.
:type input_args: dict
:param ... | [
"Executes",
"a",
"task",
"of",
"the",
"workflow",
".",
":",
"param",
"dependency",
":",
"A",
"workflow",
"dependency",
":",
"type",
"dependency",
":",
"Dependency",
":",
"param",
"input_args",
":",
"External",
"task",
"parameters",
".",
":",
"type",
"input_a... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L216-L239 | [
"def",
"_execute_task",
"(",
"self",
",",
"*",
",",
"dependency",
",",
"input_args",
",",
"intermediate_results",
",",
"monitor",
")",
":",
"task",
"=",
"dependency",
".",
"task",
"inputs",
"=",
"tuple",
"(",
"intermediate_results",
"[",
"self",
".",
"uuid_d... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow._relax_dependencies | Relaxes dependencies incurred by ``task_id``. After the task with ID ``task_id`` has been successfully
executed, all the tasks it depended on are upadted. If ``task_id`` was the last remaining dependency of a task
``t`` then ``t``'s result is removed from memory and, depending on ``remove_intermediate... | core/eolearn/core/eoworkflow.py | def _relax_dependencies(self, *, dependency, out_degrees, intermediate_results):
"""
Relaxes dependencies incurred by ``task_id``. After the task with ID ``task_id`` has been successfully
executed, all the tasks it depended on are upadted. If ``task_id`` was the last remaining dependency of a... | def _relax_dependencies(self, *, dependency, out_degrees, intermediate_results):
"""
Relaxes dependencies incurred by ``task_id``. After the task with ID ``task_id`` has been successfully
executed, all the tasks it depended on are upadted. If ``task_id`` was the last remaining dependency of a... | [
"Relaxes",
"dependencies",
"incurred",
"by",
"task_id",
".",
"After",
"the",
"task",
"with",
"ID",
"task_id",
"has",
"been",
"successfully",
"executed",
"all",
"the",
"tasks",
"it",
"depended",
"on",
"are",
"upadted",
".",
"If",
"task_id",
"was",
"the",
"las... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L241-L262 | [
"def",
"_relax_dependencies",
"(",
"self",
",",
"*",
",",
"dependency",
",",
"out_degrees",
",",
"intermediate_results",
")",
":",
"current_task",
"=",
"dependency",
".",
"task",
"for",
"input_task",
"in",
"dependency",
".",
"inputs",
":",
"dep",
"=",
"self",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow.get_tasks | Returns an ordered dictionary {task_name: task} of all tasks within this workflow.
:return: Ordered dictionary with key being task_name (str) and an instance of a corresponding task from this
workflow
:rtype: OrderedDict | core/eolearn/core/eoworkflow.py | def get_tasks(self):
"""Returns an ordered dictionary {task_name: task} of all tasks within this workflow.
:return: Ordered dictionary with key being task_name (str) and an instance of a corresponding task from this
workflow
:rtype: OrderedDict
"""
tasks = collect... | def get_tasks(self):
"""Returns an ordered dictionary {task_name: task} of all tasks within this workflow.
:return: Ordered dictionary with key being task_name (str) and an instance of a corresponding task from this
workflow
:rtype: OrderedDict
"""
tasks = collect... | [
"Returns",
"an",
"ordered",
"dictionary",
"{",
"task_name",
":",
"task",
"}",
"of",
"all",
"tasks",
"within",
"this",
"workflow",
".",
":",
"return",
":",
"Ordered",
"dictionary",
"with",
"key",
"being",
"task_name",
"(",
"str",
")",
"and",
"an",
"instance... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L264-L275 | [
"def",
"get_tasks",
"(",
"self",
")",
":",
"tasks",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"for",
"dep",
"in",
"self",
".",
"ordered_dependencies",
":",
"tasks",
"[",
"dep",
".",
"name",
"]",
"=",
"dep",
".",
"task",
"return",
"tasks"
] | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow.get_dot | Generates the DOT description of the underlying computational graph.
:return: The DOT representation of the computational graph
:rtype: Digraph | core/eolearn/core/eoworkflow.py | def get_dot(self):
"""Generates the DOT description of the underlying computational graph.
:return: The DOT representation of the computational graph
:rtype: Digraph
"""
dot = Digraph()
dep_to_dot_name = self._get_dep_to_dot_name_mapping(self.ordered_dependencie... | def get_dot(self):
"""Generates the DOT description of the underlying computational graph.
:return: The DOT representation of the computational graph
:rtype: Digraph
"""
dot = Digraph()
dep_to_dot_name = self._get_dep_to_dot_name_mapping(self.ordered_dependencie... | [
"Generates",
"the",
"DOT",
"description",
"of",
"the",
"underlying",
"computational",
"graph",
".",
":",
"return",
":",
"The",
"DOT",
"representation",
"of",
"the",
"computational",
"graph",
":",
"rtype",
":",
"Digraph"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L277-L291 | [
"def",
"get_dot",
"(",
"self",
")",
":",
"dot",
"=",
"Digraph",
"(",
")",
"dep_to_dot_name",
"=",
"self",
".",
"_get_dep_to_dot_name_mapping",
"(",
"self",
".",
"ordered_dependencies",
")",
"for",
"dep",
"in",
"self",
".",
"ordered_dependencies",
":",
"for",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow._get_dep_to_dot_name_mapping | Creates mapping between Dependency classes and names used in DOT graph | core/eolearn/core/eoworkflow.py | def _get_dep_to_dot_name_mapping(dependencies):
""" Creates mapping between Dependency classes and names used in DOT graph
"""
dot_name_to_deps = {}
for dep in dependencies:
dot_name = dep.name
if dot_name not in dot_name_to_deps:
dot_name... | def _get_dep_to_dot_name_mapping(dependencies):
""" Creates mapping between Dependency classes and names used in DOT graph
"""
dot_name_to_deps = {}
for dep in dependencies:
dot_name = dep.name
if dot_name not in dot_name_to_deps:
dot_name... | [
"Creates",
"mapping",
"between",
"Dependency",
"classes",
"and",
"names",
"used",
"in",
"DOT",
"graph"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L294-L315 | [
"def",
"_get_dep_to_dot_name_mapping",
"(",
"dependencies",
")",
":",
"dot_name_to_deps",
"=",
"{",
"}",
"for",
"dep",
"in",
"dependencies",
":",
"dot_name",
"=",
"dep",
".",
"name",
"if",
"dot_name",
"not",
"in",
"dot_name_to_deps",
":",
"dot_name_to_deps",
"["... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | EOWorkflow.dependency_graph | Visualize the computational graph.
:param filename: Filename of the output image together with file extension. Supported formats: `png`, `jpg`,
`pdf`, ... . Check `graphviz` Python package for more options
:type filename: str
:return: The DOT representation of the computational... | core/eolearn/core/eoworkflow.py | def dependency_graph(self, filename=None):
"""Visualize the computational graph.
:param filename: Filename of the output image together with file extension. Supported formats: `png`, `jpg`,
`pdf`, ... . Check `graphviz` Python package for more options
:type filename: str
... | def dependency_graph(self, filename=None):
"""Visualize the computational graph.
:param filename: Filename of the output image together with file extension. Supported formats: `png`, `jpg`,
`pdf`, ... . Check `graphviz` Python package for more options
:type filename: str
... | [
"Visualize",
"the",
"computational",
"graph",
".",
":",
"param",
"filename",
":",
"Filename",
"of",
"the",
"output",
"image",
"together",
"with",
"file",
"extension",
".",
"Supported",
"formats",
":",
"png",
"jpg",
"pdf",
"...",
".",
"Check",
"graphviz",
"Py... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L317-L334 | [
"def",
"dependency_graph",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"dot",
"=",
"self",
".",
"get_dot",
"(",
")",
"dot",
".",
"attr",
"(",
"rankdir",
"=",
"'LR'",
")",
"# Show graph from left to right\r",
"if",
"filename",
"is",
"not",
"None",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | LinearWorkflow._make_tasks_unique | If some tasks of the workflow are the same they are deep copied. | core/eolearn/core/eoworkflow.py | def _make_tasks_unique(tasks):
"""If some tasks of the workflow are the same they are deep copied."""
unique_tasks = []
prev_tasks = set()
for task in tasks:
if task in prev_tasks:
task = copy.deepcopy(task)
unique_tasks.append(task)
... | def _make_tasks_unique(tasks):
"""If some tasks of the workflow are the same they are deep copied."""
unique_tasks = []
prev_tasks = set()
for task in tasks:
if task in prev_tasks:
task = copy.deepcopy(task)
unique_tasks.append(task)
... | [
"If",
"some",
"tasks",
"of",
"the",
"workflow",
"are",
"the",
"same",
"they",
"are",
"deep",
"copied",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L352-L362 | [
"def",
"_make_tasks_unique",
"(",
"tasks",
")",
":",
"unique_tasks",
"=",
"[",
"]",
"prev_tasks",
"=",
"set",
"(",
")",
"for",
"task",
"in",
"tasks",
":",
"if",
"task",
"in",
"prev_tasks",
":",
"task",
"=",
"copy",
".",
"deepcopy",
"(",
"task",
")",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | WorkflowResults.items | Returns dictionary items | core/eolearn/core/eoworkflow.py | def items(self):
""" Returns dictionary items """
return {dep.task: value for dep, value in self._result.items()}.items() | def items(self):
""" Returns dictionary items """
return {dep.task: value for dep, value in self._result.items()}.items() | [
"Returns",
"dictionary",
"items"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L455-L457 | [
"def",
"items",
"(",
"self",
")",
":",
"return",
"{",
"dep",
".",
"task",
":",
"value",
"for",
"dep",
",",
"value",
"in",
"self",
".",
"_result",
".",
"items",
"(",
")",
"}",
".",
"items",
"(",
")"
] | b8c390b9f553c561612fe9eb64e720611633a035 |
train | WorkflowResults.get | Dictionary get method | core/eolearn/core/eoworkflow.py | def get(self, key, default=None):
""" Dictionary get method """
if isinstance(key, EOTask):
key = self._uuid_dict[key.private_task_config.uuid]
return self._result.get(key, default) | def get(self, key, default=None):
""" Dictionary get method """
if isinstance(key, EOTask):
key = self._uuid_dict[key.private_task_config.uuid]
return self._result.get(key, default) | [
"Dictionary",
"get",
"method"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/eoworkflow.py#L459-L463 | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"key",
",",
"EOTask",
")",
":",
"key",
"=",
"self",
".",
"_uuid_dict",
"[",
"key",
".",
"private_task_config",
".",
"uuid",
"]",
"return",
"self",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | MorphologicalOperations.get_operation | Maps morphological operation type to function
:param morph_type: Morphological operation type
:type morph_type: MorphologicalOperations
:return: function | ml_tools/eolearn/ml_tools/postprocessing.py | def get_operation(cls, morph_type):
""" Maps morphological operation type to function
:param morph_type: Morphological operation type
:type morph_type: MorphologicalOperations
:return: function
"""
return {
cls.OPENING: skimage.morphology.opening,
... | def get_operation(cls, morph_type):
""" Maps morphological operation type to function
:param morph_type: Morphological operation type
:type morph_type: MorphologicalOperations
:return: function
"""
return {
cls.OPENING: skimage.morphology.opening,
... | [
"Maps",
"morphological",
"operation",
"type",
"to",
"function",
":",
"param",
"morph_type",
":",
"Morphological",
"operation",
"type",
":",
"type",
"morph_type",
":",
"MorphologicalOperations",
":",
"return",
":",
"function"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/postprocessing.py#L25-L38 | [
"def",
"get_operation",
"(",
"cls",
",",
"morph_type",
")",
":",
"return",
"{",
"cls",
".",
"OPENING",
":",
"skimage",
".",
"morphology",
".",
"opening",
",",
"cls",
".",
"CLOSING",
":",
"skimage",
".",
"morphology",
".",
"closing",
",",
"cls",
".",
"D... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | PostprocessingTask.execute | Execute method takes EOPatch and changes the specified feature | ml_tools/eolearn/ml_tools/postprocessing.py | def execute(self, eopatch):
""" Execute method takes EOPatch and changes the specified feature
"""
feature_type, feature_name = next(self.feature(eopatch))
eopatch[feature_type][feature_name] = self.process(eopatch[feature_type][feature_name])
return eopatch | def execute(self, eopatch):
""" Execute method takes EOPatch and changes the specified feature
"""
feature_type, feature_name = next(self.feature(eopatch))
eopatch[feature_type][feature_name] = self.process(eopatch[feature_type][feature_name])
return eopatch | [
"Execute",
"method",
"takes",
"EOPatch",
"and",
"changes",
"the",
"specified",
"feature"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/postprocessing.py#L103-L110 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
")",
":",
"feature_type",
",",
"feature_name",
"=",
"next",
"(",
"self",
".",
"feature",
"(",
"eopatch",
")",
")",
"eopatch",
"[",
"feature_type",
"]",
"[",
"feature_name",
"]",
"=",
"self",
".",
"process",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | MorphologicalFilterTask.process | Applies the morphological operation to the mask object | ml_tools/eolearn/ml_tools/postprocessing.py | def process(self, raster):
""" Applies the morphological operation to the mask object
"""
dim = len(raster.shape)
if dim == 3:
for dim in range(raster.shape[2]):
raster[:, :, dim] = self.morph_operation(raster[:, :, dim], self.struct_elem)
elif ... | def process(self, raster):
""" Applies the morphological operation to the mask object
"""
dim = len(raster.shape)
if dim == 3:
for dim in range(raster.shape[2]):
raster[:, :, dim] = self.morph_operation(raster[:, :, dim], self.struct_elem)
elif ... | [
"Applies",
"the",
"morphological",
"operation",
"to",
"the",
"mask",
"object"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/postprocessing.py#L133-L146 | [
"def",
"process",
"(",
"self",
",",
"raster",
")",
":",
"dim",
"=",
"len",
"(",
"raster",
".",
"shape",
")",
"if",
"dim",
"==",
"3",
":",
"for",
"dim",
"in",
"range",
"(",
"raster",
".",
"shape",
"[",
"2",
"]",
")",
":",
"raster",
"[",
":",
"... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | DirectedGraph.get_outdegrees | :return: dictionary of out-degrees, see get_outdegree | core/eolearn/core/graph.py | def get_outdegrees(self):
"""
:return: dictionary of out-degrees, see get_outdegree
"""
return {vertex: len(self.adj_dict[vertex]) for vertex in self.adj_dict} | def get_outdegrees(self):
"""
:return: dictionary of out-degrees, see get_outdegree
"""
return {vertex: len(self.adj_dict[vertex]) for vertex in self.adj_dict} | [
":",
"return",
":",
"dictionary",
"of",
"out",
"-",
"degrees",
"see",
"get_outdegree"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/graph.py#L75-L79 | [
"def",
"get_outdegrees",
"(",
"self",
")",
":",
"return",
"{",
"vertex",
":",
"len",
"(",
"self",
".",
"adj_dict",
"[",
"vertex",
"]",
")",
"for",
"vertex",
"in",
"self",
".",
"adj_dict",
"}"
] | b8c390b9f553c561612fe9eb64e720611633a035 |
train | DirectedGraph.add_edge | Adds the edge ``u_vertex -> v_vertex`` to the graph if the edge is not already present.
:param u_vertex: Vertex
:param v_vertex: Vertex
:return: ``True`` if a new edge was added. ``False`` otherwise. | core/eolearn/core/graph.py | def add_edge(self, u_vertex, v_vertex):
"""Adds the edge ``u_vertex -> v_vertex`` to the graph if the edge is not already present.
:param u_vertex: Vertex
:param v_vertex: Vertex
:return: ``True`` if a new edge was added. ``False`` otherwise.
"""
self._vertices.ad... | def add_edge(self, u_vertex, v_vertex):
"""Adds the edge ``u_vertex -> v_vertex`` to the graph if the edge is not already present.
:param u_vertex: Vertex
:param v_vertex: Vertex
:return: ``True`` if a new edge was added. ``False`` otherwise.
"""
self._vertices.ad... | [
"Adds",
"the",
"edge",
"u_vertex",
"-",
">",
"v_vertex",
"to",
"the",
"graph",
"if",
"the",
"edge",
"is",
"not",
"already",
"present",
".",
":",
"param",
"u_vertex",
":",
"Vertex",
":",
"param",
"v_vertex",
":",
"Vertex",
":",
"return",
":",
"True",
"i... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/graph.py#L81-L95 | [
"def",
"add_edge",
"(",
"self",
",",
"u_vertex",
",",
"v_vertex",
")",
":",
"self",
".",
"_vertices",
".",
"add",
"(",
"u_vertex",
")",
"self",
".",
"_vertices",
".",
"add",
"(",
"v_vertex",
")",
"if",
"not",
"self",
".",
"is_edge",
"(",
"u_vertex",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | DirectedGraph.del_edge | Removes the edge ``u_vertex -> v_vertex`` from the graph if the edge is present.
:param u_vertex: Vertex
:param v_vertex: Vertex
:return: ``True`` if the existing edge was removed. ``False`` otherwise. | core/eolearn/core/graph.py | def del_edge(self, u_vertex, v_vertex):
"""Removes the edge ``u_vertex -> v_vertex`` from the graph if the edge is present.
:param u_vertex: Vertex
:param v_vertex: Vertex
:return: ``True`` if the existing edge was removed. ``False`` otherwise.
"""
if self.is_edge... | def del_edge(self, u_vertex, v_vertex):
"""Removes the edge ``u_vertex -> v_vertex`` from the graph if the edge is present.
:param u_vertex: Vertex
:param v_vertex: Vertex
:return: ``True`` if the existing edge was removed. ``False`` otherwise.
"""
if self.is_edge... | [
"Removes",
"the",
"edge",
"u_vertex",
"-",
">",
"v_vertex",
"from",
"the",
"graph",
"if",
"the",
"edge",
"is",
"present",
".",
":",
"param",
"u_vertex",
":",
"Vertex",
":",
"param",
"v_vertex",
":",
"Vertex",
":",
"return",
":",
"True",
"if",
"the",
"e... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/graph.py#L97-L109 | [
"def",
"del_edge",
"(",
"self",
",",
"u_vertex",
",",
"v_vertex",
")",
":",
"if",
"self",
".",
"is_edge",
"(",
"u_vertex",
",",
"v_vertex",
")",
":",
"self",
".",
"indegrees",
"[",
"v_vertex",
"]",
"-=",
"1",
"self",
".",
"adj_dict",
"[",
"u_vertex",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | DirectedGraph.add_vertex | Adds a new vertex to the graph if not present.
:param vertex: Vertex
:return: ``True`` if ``vertex`` added and not yet present. ``False`` otherwise. | core/eolearn/core/graph.py | def add_vertex(self, vertex):
"""Adds a new vertex to the graph if not present.
:param vertex: Vertex
:return: ``True`` if ``vertex`` added and not yet present. ``False`` otherwise.
"""
if vertex not in self._vertices:
self._vertices.add(vertex)
r... | def add_vertex(self, vertex):
"""Adds a new vertex to the graph if not present.
:param vertex: Vertex
:return: ``True`` if ``vertex`` added and not yet present. ``False`` otherwise.
"""
if vertex not in self._vertices:
self._vertices.add(vertex)
r... | [
"Adds",
"a",
"new",
"vertex",
"to",
"the",
"graph",
"if",
"not",
"present",
".",
":",
"param",
"vertex",
":",
"Vertex",
":",
"return",
":",
"True",
"if",
"vertex",
"added",
"and",
"not",
"yet",
"present",
".",
"False",
"otherwise",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/graph.py#L111-L121 | [
"def",
"add_vertex",
"(",
"self",
",",
"vertex",
")",
":",
"if",
"vertex",
"not",
"in",
"self",
".",
"_vertices",
":",
"self",
".",
"_vertices",
".",
"add",
"(",
"vertex",
")",
"return",
"True",
"return",
"False"
] | b8c390b9f553c561612fe9eb64e720611633a035 |
train | DirectedGraph.del_vertex | Removes the vertex ``vertex`` and all incident edges from the graph.
**Note** that this is an expensive operation that should be avoided!
Running time is O(V+E)
:param vertex: Vertex
:return: ``True`` if ``vertex`` was removed from the graph. ``False`` otherwise. | core/eolearn/core/graph.py | def del_vertex(self, vertex):
"""Removes the vertex ``vertex`` and all incident edges from the graph.
**Note** that this is an expensive operation that should be avoided!
Running time is O(V+E)
:param vertex: Vertex
:return: ``True`` if ``vertex`` was removed from the ... | def del_vertex(self, vertex):
"""Removes the vertex ``vertex`` and all incident edges from the graph.
**Note** that this is an expensive operation that should be avoided!
Running time is O(V+E)
:param vertex: Vertex
:return: ``True`` if ``vertex`` was removed from the ... | [
"Removes",
"the",
"vertex",
"vertex",
"and",
"all",
"incident",
"edges",
"from",
"the",
"graph",
".",
"**",
"Note",
"**",
"that",
"this",
"is",
"an",
"expensive",
"operation",
"that",
"should",
"be",
"avoided!",
"Running",
"time",
"is",
"O",
"(",
"V",
"+... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/graph.py#L123-L144 | [
"def",
"del_vertex",
"(",
"self",
",",
"vertex",
")",
":",
"for",
"v_vertex",
"in",
"self",
".",
"adj_dict",
"[",
"vertex",
"]",
":",
"self",
".",
"indegrees",
"[",
"v_vertex",
"]",
"-=",
"1",
"for",
"v_vertex",
"in",
"self",
".",
"vertices",
"(",
")... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | DirectedGraph.from_edges | Return DirectedGraph created from edges
:param edges:
:return: DirectedGraph | core/eolearn/core/graph.py | def from_edges(edges):
""" Return DirectedGraph created from edges
:param edges:
:return: DirectedGraph
"""
dag = DirectedGraph()
for _u, _v in edges:
dag.add_edge(_u, _v)
return dag | def from_edges(edges):
""" Return DirectedGraph created from edges
:param edges:
:return: DirectedGraph
"""
dag = DirectedGraph()
for _u, _v in edges:
dag.add_edge(_u, _v)
return dag | [
"Return",
"DirectedGraph",
"created",
"from",
"edges",
":",
"param",
"edges",
":",
":",
"return",
":",
"DirectedGraph"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/graph.py#L166-L174 | [
"def",
"from_edges",
"(",
"edges",
")",
":",
"dag",
"=",
"DirectedGraph",
"(",
")",
"for",
"_u",
",",
"_v",
"in",
"edges",
":",
"dag",
".",
"add_edge",
"(",
"_u",
",",
"_v",
")",
"return",
"dag"
] | b8c390b9f553c561612fe9eb64e720611633a035 |
train | DirectedGraph._is_cyclic | True if the directed graph dag contains a cycle. False otherwise.
The algorithm is naive, running in O(V^2) time, and not intended for serious use! For production purposes on
larger graphs consider implementing Tarjan's O(V+E)-time algorithm instead.
:type dag: DirectedGraph | core/eolearn/core/graph.py | def _is_cyclic(dag):
"""True if the directed graph dag contains a cycle. False otherwise.
The algorithm is naive, running in O(V^2) time, and not intended for serious use! For production purposes on
larger graphs consider implementing Tarjan's O(V+E)-time algorithm instead.
:type... | def _is_cyclic(dag):
"""True if the directed graph dag contains a cycle. False otherwise.
The algorithm is naive, running in O(V^2) time, and not intended for serious use! For production purposes on
larger graphs consider implementing Tarjan's O(V+E)-time algorithm instead.
:type... | [
"True",
"if",
"the",
"directed",
"graph",
"dag",
"contains",
"a",
"cycle",
".",
"False",
"otherwise",
".",
"The",
"algorithm",
"is",
"naive",
"running",
"in",
"O",
"(",
"V^2",
")",
"time",
"and",
"not",
"intended",
"for",
"serious",
"use!",
"For",
"produ... | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/graph.py#L187-L208 | [
"def",
"_is_cyclic",
"(",
"dag",
")",
":",
"# pylint: disable=invalid-name\r",
"vertices",
"=",
"dag",
".",
"vertices",
"(",
")",
"for",
"w",
"in",
"vertices",
":",
"stack",
"=",
"[",
"w",
"]",
"seen",
"=",
"set",
"(",
")",
"while",
"stack",
":",
"u",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | AddValidDataMaskTask.execute | Execute predicate on input eopatch
:param eopatch: Input `eopatch` instance
:return: The same `eopatch` instance with a `mask.valid_data` array computed according to the predicate | mask/eolearn/mask/masking.py | def execute(self, eopatch):
""" Execute predicate on input eopatch
:param eopatch: Input `eopatch` instance
:return: The same `eopatch` instance with a `mask.valid_data` array computed according to the predicate
"""
feature_type, feature_name = next(self.valid_data_feature())
... | def execute(self, eopatch):
""" Execute predicate on input eopatch
:param eopatch: Input `eopatch` instance
:return: The same `eopatch` instance with a `mask.valid_data` array computed according to the predicate
"""
feature_type, feature_name = next(self.valid_data_feature())
... | [
"Execute",
"predicate",
"on",
"input",
"eopatch"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/mask/eolearn/mask/masking.py#L30-L38 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
")",
":",
"feature_type",
",",
"feature_name",
"=",
"next",
"(",
"self",
".",
"valid_data_feature",
"(",
")",
")",
"eopatch",
"[",
"feature_type",
"]",
"[",
"feature_name",
"]",
"=",
"self",
".",
"predicate",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | MaskFeature.execute | Mask values of `feature` according to the `mask_values` in `mask_feature`
:param eopatch: `eopatch` to be processed
:return: Same `eopatch` instance with masked `feature` | mask/eolearn/mask/masking.py | def execute(self, eopatch):
""" Mask values of `feature` according to the `mask_values` in `mask_feature`
:param eopatch: `eopatch` to be processed
:return: Same `eopatch` instance with masked `feature`
"""
feature_type, feature_name, new_feature_name = next(self.feature(eopatch... | def execute(self, eopatch):
""" Mask values of `feature` according to the `mask_values` in `mask_feature`
:param eopatch: `eopatch` to be processed
:return: Same `eopatch` instance with masked `feature`
"""
feature_type, feature_name, new_feature_name = next(self.feature(eopatch... | [
"Mask",
"values",
"of",
"feature",
"according",
"to",
"the",
"mask_values",
"in",
"mask_feature"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/mask/eolearn/mask/masking.py#L67-L87 | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
")",
":",
"feature_type",
",",
"feature_name",
",",
"new_feature_name",
"=",
"next",
"(",
"self",
".",
"feature",
"(",
"eopatch",
")",
")",
"mask_feature_type",
",",
"mask_feature_name",
"=",
"next",
"(",
"self"... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureType.ndim | If given FeatureType stores a dictionary of numpy.ndarrays it returns dimensions of such arrays. | core/eolearn/core/constants.py | def ndim(self):
"""If given FeatureType stores a dictionary of numpy.ndarrays it returns dimensions of such arrays."""
if self.is_raster():
return {
FeatureType.DATA: 4,
FeatureType.MASK: 4,
FeatureType.SCALAR: 2,
FeatureType.LA... | def ndim(self):
"""If given FeatureType stores a dictionary of numpy.ndarrays it returns dimensions of such arrays."""
if self.is_raster():
return {
FeatureType.DATA: 4,
FeatureType.MASK: 4,
FeatureType.SCALAR: 2,
FeatureType.LA... | [
"If",
"given",
"FeatureType",
"stores",
"a",
"dictionary",
"of",
"numpy",
".",
"ndarrays",
"it",
"returns",
"dimensions",
"of",
"such",
"arrays",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/constants.py#L88-L101 | [
"def",
"ndim",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_raster",
"(",
")",
":",
"return",
"{",
"FeatureType",
".",
"DATA",
":",
"4",
",",
"FeatureType",
".",
"MASK",
":",
"4",
",",
"FeatureType",
".",
"SCALAR",
":",
"2",
",",
"FeatureType",
".... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FeatureType.type | Returns type of the data for the given FeatureType. | core/eolearn/core/constants.py | def type(self):
"""Returns type of the data for the given FeatureType."""
if self is FeatureType.TIMESTAMP:
return list
if self is FeatureType.BBOX:
return BBox
return dict | def type(self):
"""Returns type of the data for the given FeatureType."""
if self is FeatureType.TIMESTAMP:
return list
if self is FeatureType.BBOX:
return BBox
return dict | [
"Returns",
"type",
"of",
"the",
"data",
"for",
"the",
"given",
"FeatureType",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/constants.py#L103-L109 | [
"def",
"type",
"(",
"self",
")",
":",
"if",
"self",
"is",
"FeatureType",
".",
"TIMESTAMP",
":",
"return",
"list",
"if",
"self",
"is",
"FeatureType",
".",
"BBOX",
":",
"return",
"BBox",
"return",
"dict"
] | b8c390b9f553c561612fe9eb64e720611633a035 |
train | FileFormat.split_by_extensions | Splits the filename string by the extension of the file | core/eolearn/core/constants.py | def split_by_extensions(filename):
""" Splits the filename string by the extension of the file
"""
parts = filename.split('.')
idx = len(parts) - 1
while FileFormat.is_file_format(parts[idx]):
parts[idx] = FileFormat(parts[idx])
idx -= 1
return ['.... | def split_by_extensions(filename):
""" Splits the filename string by the extension of the file
"""
parts = filename.split('.')
idx = len(parts) - 1
while FileFormat.is_file_format(parts[idx]):
parts[idx] = FileFormat(parts[idx])
idx -= 1
return ['.... | [
"Splits",
"the",
"filename",
"string",
"by",
"the",
"extension",
"of",
"the",
"file"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/constants.py#L151-L159 | [
"def",
"split_by_extensions",
"(",
"filename",
")",
":",
"parts",
"=",
"filename",
".",
"split",
"(",
"'.'",
")",
"idx",
"=",
"len",
"(",
"parts",
")",
"-",
"1",
"while",
"FileFormat",
".",
"is_file_format",
"(",
"parts",
"[",
"idx",
"]",
")",
":",
"... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | SGMLBaseValidator.reset_counters | Resets all counters, truth and classification masks. | ml_tools/eolearn/ml_tools/validator.py | def reset_counters(self):
"""
Resets all counters, truth and classification masks.
"""
self.truth_masks = None
self.classification_masks = None
self.pixel_truth_counts = None
self.pixel_classification_counts = None
self.pixel_truth_sum = None
self.... | def reset_counters(self):
"""
Resets all counters, truth and classification masks.
"""
self.truth_masks = None
self.classification_masks = None
self.pixel_truth_counts = None
self.pixel_classification_counts = None
self.pixel_truth_sum = None
self.... | [
"Resets",
"all",
"counters",
"truth",
"and",
"classification",
"masks",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/validator.py#L76-L87 | [
"def",
"reset_counters",
"(",
"self",
")",
":",
"self",
".",
"truth_masks",
"=",
"None",
"self",
".",
"classification_masks",
"=",
"None",
"self",
".",
"pixel_truth_counts",
"=",
"None",
"self",
".",
"pixel_classification_counts",
"=",
"None",
"self",
".",
"pi... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | SGMLBaseValidator._count_truth_pixels | Count the pixels belonging to each truth class | ml_tools/eolearn/ml_tools/validator.py | def _count_truth_pixels(self):
"""
Count the pixels belonging to each truth class
"""
pixel_count = np.array([[np.nonzero(mask)[0].shape[0] for mask in masktype]
for masktype in self.truth_masks])
pixel_count = np.moveaxis(pixel_count, 0, -1)
... | def _count_truth_pixels(self):
"""
Count the pixels belonging to each truth class
"""
pixel_count = np.array([[np.nonzero(mask)[0].shape[0] for mask in masktype]
for masktype in self.truth_masks])
pixel_count = np.moveaxis(pixel_count, 0, -1)
... | [
"Count",
"the",
"pixels",
"belonging",
"to",
"each",
"truth",
"class"
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/validator.py#L89-L101 | [
"def",
"_count_truth_pixels",
"(",
"self",
")",
":",
"pixel_count",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"np",
".",
"nonzero",
"(",
"mask",
")",
"[",
"0",
"]",
".",
"shape",
"[",
"0",
"]",
"for",
"mask",
"in",
"masktype",
"]",
"for",
"masktype",... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | SGMLBaseValidator._count_classified_pixels | Count the pixels belonging to each classified class. | ml_tools/eolearn/ml_tools/validator.py | def _count_classified_pixels(self):
"""
Count the pixels belonging to each classified class.
"""
class_values = self.class_dictionary.values()
classification_count = np.array([[[np.count_nonzero(prediction[np.nonzero(mask)] == class_val)
... | def _count_classified_pixels(self):
"""
Count the pixels belonging to each classified class.
"""
class_values = self.class_dictionary.values()
classification_count = np.array([[[np.count_nonzero(prediction[np.nonzero(mask)] == class_val)
... | [
"Count",
"the",
"pixels",
"belonging",
"to",
"each",
"classified",
"class",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/validator.py#L103-L120 | [
"def",
"_count_classified_pixels",
"(",
"self",
")",
":",
"class_values",
"=",
"self",
".",
"class_dictionary",
".",
"values",
"(",
")",
"classification_count",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"[",
"np",
".",
"count_nonzero",
"(",
"prediction",
"[",
... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | SGMLBaseValidator.add_validation_patch | Extracts ground truth and classification results from the EOPatch and
aggregates the results. | ml_tools/eolearn/ml_tools/validator.py | def add_validation_patch(self, patch):
"""
Extracts ground truth and classification results from the EOPatch and
aggregates the results.
"""
# 2. Convert 8-bit mask
self._transform_truth(patch)
# 3. Count truth labeled pixels
self._count_truth_pixels()
... | def add_validation_patch(self, patch):
"""
Extracts ground truth and classification results from the EOPatch and
aggregates the results.
"""
# 2. Convert 8-bit mask
self._transform_truth(patch)
# 3. Count truth labeled pixels
self._count_truth_pixels()
... | [
"Extracts",
"ground",
"truth",
"and",
"classification",
"results",
"from",
"the",
"EOPatch",
"and",
"aggregates",
"the",
"results",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/validator.py#L130-L147 | [
"def",
"add_validation_patch",
"(",
"self",
",",
"patch",
")",
":",
"# 2. Convert 8-bit mask",
"self",
".",
"_transform_truth",
"(",
"patch",
")",
"# 3. Count truth labeled pixels",
"self",
".",
"_count_truth_pixels",
"(",
")",
"# 5. Perform classification",
"self",
"."... | b8c390b9f553c561612fe9eb64e720611633a035 |
train | SGMLBaseValidator.validate | Aggregate the results from all EOPatches. | ml_tools/eolearn/ml_tools/validator.py | def validate(self):
"""
Aggregate the results from all EOPatches.
"""
self.pixel_truth_sum = np.sum(self.pixel_truth_counts, axis=0)
self.pixel_classification_sum = np.sum(self.pixel_classification_counts, axis=0) | def validate(self):
"""
Aggregate the results from all EOPatches.
"""
self.pixel_truth_sum = np.sum(self.pixel_truth_counts, axis=0)
self.pixel_classification_sum = np.sum(self.pixel_classification_counts, axis=0) | [
"Aggregate",
"the",
"results",
"from",
"all",
"EOPatches",
"."
] | sentinel-hub/eo-learn | python | https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/ml_tools/eolearn/ml_tools/validator.py#L149-L154 | [
"def",
"validate",
"(",
"self",
")",
":",
"self",
".",
"pixel_truth_sum",
"=",
"np",
".",
"sum",
"(",
"self",
".",
"pixel_truth_counts",
",",
"axis",
"=",
"0",
")",
"self",
".",
"pixel_classification_sum",
"=",
"np",
".",
"sum",
"(",
"self",
".",
"pixe... | b8c390b9f553c561612fe9eb64e720611633a035 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.