Skip to content

Commit

Permalink
Merge pull request #7 from NASA-IMPACT/check_sentinel_cloud
Browse files Browse the repository at this point in the history
Command to check cloud assessment from MTD_MSIL1C.xml for Sentinel 2.
  • Loading branch information
sharkinsspatial authored Jan 12, 2021
2 parents 11d485c + 114189e commit 386db0b
Show file tree
Hide file tree
Showing 5 changed files with 468 additions and 1 deletion.
Empty file.
22 changes: 22 additions & 0 deletions check_sentinel_clouds/check_sentinel_clouds.py
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()
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
]},
)
Loading

0 comments on commit 386db0b

Please sign in to comment.