-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from NASA-IMPACT/check_sentinel_cloud
Command to check cloud assessment from MTD_MSIL1C.xml for Sentinel 2.
- Loading branch information
Showing
5 changed files
with
468 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from lxml import etree | ||
import click | ||
|
||
|
||
@click.command() | ||
@click.argument( | ||
"inputxml", | ||
type=click.Path(dir_okay=False, file_okay=True,), | ||
) | ||
def main(inputxml): | ||
"""check_sentinel_clouds MTD_MSIL1C.xml""" | ||
doc = etree.parse(inputxml) | ||
element = doc.xpath("//Cloud_Coverage_Assessment")[0] | ||
cloud = float(element.text) | ||
if (cloud > 95): | ||
click.echo("invalid") | ||
else: | ||
click.echo("valid") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
"lxml", | ||
"espa-python-library @ git+https://github.com/USGS-EROS/[email protected]#egg=espa-python-library" | ||
], | ||
nclude_package_data=True, | ||
include_package_data=True, | ||
extras_require={"dev": ["flake8", "black"], "test": ["flake8", "pytest"]}, | ||
entry_points={"console_scripts": [ | ||
"parse_fmask=parse_fmask.parse_fmask:main", | ||
|
@@ -19,5 +19,6 @@ | |
"get_doy=get_doy.get_doy:main", | ||
"create_sr_hdf_xml=create_sr_hdf_xml.create_sr_hdf_xml:main", | ||
"create_landsat_sr_hdf_xml=create_landsat_sr_hdf_xml.create_landsat_sr_hdf_xml:main", | ||
"check_sentinel_clouds=check_sentinel_clouds.check_sentinel_clouds:main", | ||
]}, | ||
) |
Oops, something went wrong.