cordmaur / waterdetect Goto Github PK
View Code? Open in Web Editor NEWWater Detect Algorithm
License: Apache License 2.0
Water Detect Algorithm
License: Apache License 2.0
Can we input tiff images?
Is there any support for combining image tiles before running the algorithm?
Or, alternatively, will water detection performance be degraded by classifying tiles separately?
I'm studying a watershed right at the intersection of several Sentinel-2 tiles and trying to figure out the best way to handle it. Thanks!
Hello,
I am newbie and trying to replicate this project on a EC2 instance and i have completed all the setup, created input and output folders in in the instance.
I would like to know what file format i should upload in to the input folder to run the water detect command? can i use the sentinel open data on aws? if yes, can you direct me to the right file type.
Thank you for your support
Hi,
Thank you for creating this library. It looks great. I am trying to use it to detect water in some satellite images. We have the 'tif' files (i.e. S2B_MSIL2A_20220508T155819_N0400_R097_T17RLN_20220508T205707_1018.tif). The tif file is already sized to a 3.5 miles by 3.5 mile. However, we get the following error -> 'DWWaterDetect' has no attribute 'run_single'.
In addition, I am not sure the reason for using the shape file
This is how we are calling the function - do we need a shape file or is it optional? Thank you in advance for your help.
water_mask = wd.DWWaterDetect.run_single(image_folder='Img/',
temp_folder='tmp/'
# shape_file='D:/Shp/Area_Tiete.shp'
)
Hi,
thank you so much for the package and I was testing the sentinel-2 with single mode. Weather the pdf_reports = True or False and the create_composite =True or Flase, the error 'No such file or directory : 'Output/data/data_composite.pdf' happened. Would you please give me any advice?
cheers.
Input (ran from the jupyter notebook, so i leave the original !
):
!waterdetect -i {input_folder} -o {output_folder}
Output:
Loading configuration file WaterDetect.ini
File WaterDetect.ini verified.
Folder / verified.
Folder /waterdetect_test verified.
Opening image in folder /waterdetect_test
Retrieving bands for product S2_THEIA
Opening image in folder /SENTINEL2A_20180824-100141-227_L2A_T33TVL_C_V1-0
Retrieving bands for product S2_THEIA
10 were found:
Loading band: Blue
Loading band: Green
Loading band: Red
Loading band: Mir
Loading band: Mir2
Loading band: Nir
Loading band: Nir2
Loading band: RedEdg1
Loading band: RedEdg2
Loading band: RedEdg3
0...10...20...30...40...50...60...70...80...90...100 - done.
Input file size is 10980, 10980
0...10...20...30...40...50...60...70...80...90...100 - done.
Saving image: /SENTINEL2A_20180824-100141-227_L2A_T33TVL_C_V1-0_invalid_mask.tif
Calculating clusters for the following combination of bands:
['mndwi', 'ndwi', 'Mir2']
Killed
The process stops. This are the files it creates (and apparently copies?)
I have updated the process in "Running without GDAL" with reference to the media article (Water Detection in High Resolution Satellite Images using the waterdetect python package) that describes it in more detail.
Here, I use waterdetect to extract water bodies from a scene of Landsat TM imagery.
import waterdetect as wd
import rasterio
from osgeo import gdal
!waterdetect -GC
Copying c:\users\gw_studio\documents\miniconda3\lib\site-packages\WaterDetect.ini into current dir.
WaterDetect.ini copied into C:\Users\GW_Studio\Documents\PythonCode.
config = wd.DWConfig(config_file='WaterDetect.ini')
Loading configuration file WaterDetect.ini
File WaterDetect.ini verified.
config.clustering_bands, config.detect_water_cluster
([['mndwi', 'ndwi', 'Mir2']], 'maxmbwi')
b2 = rasterio.open('D:\LT05\LT05_L1TP_122044_19911117_20200915_02_T1_B2.tif').read()
b3 = rasterio.open('D:\LT05\LT05_L1TP_122044_19911117_20200915_02_T1_B3.tif').read()
nir = rasterio.open('D:\LT05\LT05_L1TP_122044_19911117_20200915_02_T1_B4.tif').read()
mir1 = rasterio.open('D:\LT05\LT05_L1TP_122044_19911117_20200915_02_T1_B5.tif').read()
mir2 = rasterio.open('D:\LT05\LT05_L1TP_122044_19911117_20200915_02_T1_B7.tif').read()
b2.shape, b3.shape, nir.shape, mir1.shape, mir2.shape
((1, 6694, 7198),
(1, 6694, 7198),
(1, 6694, 7198),
(1, 6694, 7198),
(1, 6694, 7198))
bands = {'Green': b2.squeeze(), 'Red': b3.squeeze(), 'Nir': nir.squeeze(),'Mir': mir1.squeeze(),'Mir2': mir2.squeeze()}
wmask = wd.DWImageClustering(bands=bands, bands_keys=['Mir2', 'mndwi', 'ndwi'], invalid_mask=None, glint_processor=None, config=config)
mask = wmask.run_detect_water()
Selection of best number of clusters using Calinski-Harabasz Index:
k=2 :Calinski_harabaz index=525017.1368054692
k=3 :Calinski_harabaz index=272406.8028330963
k=4 :Calinski_harabaz index=414875.9712176703
k=5 :Calinski_harabaz index=600524.7602326183
k=6 :Calinski_harabaz index=480991.67515900405
k=7 :Calinski_harabaz index=508319.4897511767
k=8 :Calinski_harabaz index=436496.13557214226
k=9 :Calinski_harabaz index=423649.7968669792
k=10 :Calinski_harabaz index=376965.3596922822
Applying clusters based naive bayes classifier
Assgnin 1 to cluster_id 3
Skipping cluster_id 3
import matplotlib.pyplot as plt
plt.imshow(wmask.cluster_matrix)
save_ay = wmask.cluster_matrix
dataset=gdal.Open("D:\LT05\LT05_L1TP_122044_19911117_20200915_02_T1_B2.tif")
im_geotrans = dataset.GetGeoTransform()
im_proj = dataset.GetProjection()
save = wd.DWutils.array2raster(filename='test.tif', array=save_ay, geo_transform=im_geotrans, projection=im_proj, nodatavalue=-1, dtype=None)
Saving image: test.tif
This rep do not exist: https://github.com/cordmaur/WaterQuality ?
I was following this tutorial:
https://towardsdatascience.com/water-detection-in-high-resolution-satellite-images-using-the-waterdetect-python-package-7c5a031e3d16
The final section (https://gist.github.com/cordmaur/b81c113aceb81a769579bc1d44601f95#file-wd2-ipynb)
But when I do the equivalent i get the following error/output:
Loading configuration file WaterDetect.ini
File WaterDetect.ini verified.
[['mndwi', 'ndwi', 'Mir2']]
maxmbwi
OSError: Required bands not informed: {'Red', 'Mir', 'Mir2'}
I generate the config file WaterDetect.ini
with !waterdetect -GC
so it is the default
The term Mir2
isn't originally shown in the tutorial so I think something might have changed
The code I'm using is:
import waterdetect as wd # Developed for Sentinel-2
import rasterio
import matplotlib.pyplot as plt
# We will copy the configuration file to the current directory
!waterdetect -GC
config = wd.DWConfig(config_file='WaterDetect.ini')
print(config.clustering_bands)
print(config.detect_water_cluster)
# Green Band
b3 = greenB.read() # (9600 x 9600)
# NIR Band
nir = nirB.read() # (9600 x 9600)
bands = {'Green': b3 / 10000, 'Nir': nir / 10000} # No need to squeeze
wmask = wd.DWImageClustering(bands=bands, bands_keys=['Nir', 'ndwi'], invalid_mask=None, config=config)
mask = wmask.run_detect_water()
% matplotlib inline
import matplotlib.pyplot as plt
plt.imshow(wmask.water_mask == 1)
plt.imshow(wmask.cluster_matrix)
Help with this would be greatly appreciated :)
Hi,
I'm having some issues in trying to run correctly waterdetect. I tried to use it on a variety of imagery from Copernicus but it failed everytime.
I'm trying to run it on this specific tile S2B_MSIL2A_20210613T070619_N0300_R106_T40TEM_20210613T085847.SAFE
, which should be compatible with the product S2_S2COR
. However, when waterdetect runs, it returns this error:
Loading configuration file WaterDetect.ini
File WaterDetect.ini verified.
Folder /Volumes/ANSSD/testFolder/input_folder verified.
Folder /Volumes/ANSSD/testFolder/output_folder verified.
Starting WaterDetection version: 1.5.8
Opening image in folder /Volumes/ANSSD/testFolder/input_folder/S2B_MSIL2A_20210613T070619_N0300_R106_T40TEM_20210613T085847.SAFE
Retrieving bands for product S2_S2COR
70 were found:
Loading band: Blue
****** WARNING ********
More than one band _B02_10m. in image list. Skipping to the next image
Do you have any insight on how to fix it and correctly run waterdetect?
Thanks in advance!
Here, I use Waterdetect to extract water bodies from a scene of Sentinel 2 imagery.
import waterdetect as wd
import rasterio
config = wd.DWConfig(config_file='WaterDetect.ini')
config.clustering_bands, config.detect_water_cluster
Loading configuration file WaterDetect.ini
File WaterDetect.ini verified.
([['mndwi', 'ndwi', 'Mir2']], 'maxmbwi')
b3 = rasterio.open('.../T31UES_20220719T105041_B03_20m.jp2').read()
b4 = rasterio.open('.../T31UES_20220719T105041_B04_20m.jp2').read()
nir = rasterio.open('.../T31UES_20220719T105041_B8A_20m.jp2').read()
mir1 = rasterio.open('.../T31UES_20220719T105041_B11_20m.jp2').read()
mir2 = rasterio.open('.../T31UES_20220719T105041_B12_20m.jp2').read()
bands = {'Green': b3.squeeze()/10000, 'Red': b4.squeeze()/10000, 'Nir': nir.squeeze()/10000,'Mir': mir1.squeeze()/10000,'Mir2': mir2.squeeze()/10000}
wmask = wd.DWImageClustering(bands=bands, bands_keys=['Mir2', 'mndwi', 'ndwi'], invalid_mask=None, config=config)
mask = wmask.run_detect_water()
plt.imshow(wmask.cluster_matrix)
Selection of best number of clusters using Calinski-Harabasz Index:
k=2 :Calinski_harabaz index=150.58256179023687
k=3 :Calinski_harabaz index=81.65946151674528
k=4 :Calinski_harabaz index=1867.2173765910154
k=5 :Calinski_harabaz index=3691.9700226205587
k=6 :Calinski_harabaz index=3017.54521958539
k=7 :Calinski_harabaz index=2515.1876336606165
Applying clusters based naive bayes classifier
Assgnin 1 to cluster_id 3
Skipping cluster_id 3
<matplotlib.image.AxesImage at 0x7fa03fea6430>
plt.imshow(wmask.water_mask==1)
np.unique(wmask.water_mask)
array([0], dtype=int8)
np.unique(wmask.cluster_matrix)
array([0, 2, 3, 4, 5], dtype=int8)
Why my matrix "wmask.water_mask" and "wmask.water_mask" have no cluster "1" which is water ?
Hey Mauricio,
I'm Oscar Benavente, and I work as an environmental geochemist.
I'm currently working in project to monitor pitlakes physico-chemical characteristics using the HSV color of the water that can be monitored using the RGB bands of different satellite images (see the pH vs Hue relation of different pit lakes I have analyzed).
A very important part of this project is to define properly the water and non-water pixels over the pits, so HSV values can be calculated just for the pixels of water.
Since all the pipeline I have produced uses GEE python package, I want to ask you if you have plans of implementing the WaterDetect code to work directly with GEE images, instead of downloading them to your local machine.
Regards,
Oscar
Hi there. Nice package! I am currently giving it a try processing some S2_THEIA products. I have unpacked several products to a directory and run the package with
waterdetect -i ./in -o ./out -p S2_THEIA
I wanted to unpack some more scenes into my source directory and run the program again but it basically ignores the existing output and starts processing them again.
It would be fantastic if repeated runs would leave existing products untouched.
Cheers,
John
P.S. I think there is a small typo in the README:
- waterdetect -i c:/input_folder -i -c:/output_folder -p S2_THEIA
+ waterdetect -i c:/input_folder -o -c:/output_folder -p S2_THEIA
Hi Cordmaur,
Thanks for sharing this outstanding work.
I am working on a project related to water body identification and would like to have data with as high resolution as possible. I have found that by modifying the reference_band = Mir to Nir or other 10m band in the ".init" file, then I can change the resolution (to 10m) and I have successfully obtained the results.
I would like to ask if the output of the model at 10m resolution (reference_band = Nir) is better than the 10m image obtained by simply interpolating the 20m result (reference_band = Mir) with NDWI+B12 as input. I am asking this question only because I am not sure why you defaulted the reference band in the code to MIR instead of the higher resolution NIR (or other 10m bands), since your article clearly states a 10m result.
Best,
Zhen Hao
Hi!
I'm experiencing some troubles trying to run the script with a S2_L1C image, particularly this one: https://scihub.copernicus.eu/dhus/odata/v1/Products('ea4dfeee-1d28-47c5-a6a8-c86ada64768f')/$value
It seems to be some sorts of recursive problem, not sure exactly what.
This is the console output:
(base) Macbook-Pro-2020-de-*******:WaterDetect ******$ python runWaterDetect.py -i ./Input/ -o ./Output/ -s ../../../Downloads/LaJara/LaJara.shp --product S2_L1C
Loading configuration file WaterDetect.ini
File WaterDetect.ini verified.
Folder ./Input/ verified.
File ../../../Downloads/LaJara/LaJara.shp verified.
Folder ./Output/ verified.
Starting WaterDetection version: 1.5.10
Opening image in folder Input/S2A_MSIL1C_20210207T174511_N0209_R098_T13SDA_20210207T212818.SAFE
Retrieving bands for product S2_L1C
****** WARNING ********
[Errno 2] No such file or directory: 'Input/S2A_MSIL1C_20210207T174511_N0209_R098_T13SDA_20210207T212818.SAFE/GRANULE/Input/S2A_MSIL1C_20210207T174511_N0209_R098_T13SDA_20210207T212818.SAFE/GRANULE/L1C_T13SDA_A029410_20210207T175338/IMG_DATA'. Skipping to the next image
I was not able to find any other image source for that particular place.
I'm on MacOS Big Sur, and the latest version of the script.
This may seem very broad, but How to run the script?
What type of images does the script support? JPG, PNG, JPEG, or something else?
If so, then where can I get those images?
After that how to run the code step by step?
When attempting to run this it works well until running the "create_mask_report" function. After some digging I found that it's trying to open a font file that doesn't exist on Ubuntu: "arial.ttf". Looks like you can only open fonts by passing the absolute path on Ubuntu.
Recommend you include the font with the install.
.../WaterDetect/waterdetect/Common.py in create_glint_pdf(xml, name_img, output_folder, g, pdf_merger)
956 d = ImageDraw.Draw(out)
957 # font size
--> 958 font = ImageFont.truetype("arial.ttf", 16)
959
960 # Test about glint values
.../lib/python3.7/site-packages/PIL/ImageFont.py in truetype(font, size, index, encoding, layout_engine)
834
835 try:
--> 836 return freetype(font)
837 except OSError:
838 if not isPath(font):
.../lib/python3.7/site-packages/PIL/ImageFont.py in freetype(font)
831
832 def freetype(font):
--> 833 return FreeTypeFont(font, size, index, encoding, layout_engine)
834
835 try:
.../lib/python3.7/site-packages/PIL/ImageFont.py in __init__(self, font, size, index, encoding, layout_engine)
192 return
193 self.font = core.getfont(
--> 194 font, size, index, encoding, layout_engine=layout_engine
195 )
196 else:
OSError: cannot open resource
Hi,
First of all, thank you so much for the package. I am trying to run it from both (notebook and Terminal window) but I always get this error message:
"Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers)"
The whole output is this one:
Opening image in folder /home/diego/EBD/Varios/Sentinel2_Flood/imgs/sen2cor/S2B_MSIL2A_20220501T110619_N0400_R137_T30STG_20220501T131135.SAFE
Retrieving bands for product S2_S2COR
36 were found:
Loading band: Blue
Loading band: Green
Loading band: Red
Loading band: Mir
Loading band: Mir2
Loading band: RedEdg1
Loading band: RedEdg2
Loading band: RedEdg3
Loading band: Nir
Loading band: Nir2
Warning: External mask None not found!
Invalid pixels (0.23079226678080034) < maximum (0.95).
Saving final MASK
Saving image: /home/diego/EBD/Varios/Sentinel2_Flood/outputs/S2B_MSIL2A_20220501T110619_N0400_R137_T30STG_20220501T131135/S2B_MSIL2A_20220501T110619_N0400_R137_T30STG_20220501T131135_invalid_mask.tif
0...10...20...30...40...50...60...70...80...90...100 - done.
Input file size is 10980, 10980
0...10...20...30...40...50...60...70...80...90...100 - done.
Calculating clusters for the following combination of bands:
['mndwi', 'ndwi', 'Mir2']
Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).
Terminado (killed)
I'd appreciate your help.
Hello @cordmaur, Thanks very much for open sourcing this work.
I was following the code from this blog (https://www.geocorner.net/post/water-detection-in-high-resolution-satellite-images-using-the-waterdetect-python-package) especially Running without GDAL
section for my own Sentinel-2 L2A image.
I modified the .ini file to produce this output
But when generating the result, OSError: Required bands not informed: {'Mir2'}
error occurs. I tried debugging the source code but couldn't find why Mir2 is required.
wmask = wd.DWImageClustering(bands=bands, bands_keys=['Nir', 'ndwi'], invalid_mask=None, config=config)
Associated files for reproducing the issue:
Hello :-)
I'm trying to run this :
!waterdetect -GC
water_mask = wd.DWWaterDetect.run_water_detect(input_folder="C:\\Users\\david\\Documents\\py\\myenv\\nakambe_2022\\S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE",
output_folder="C:\\Users\\david\\Documents\\py\\myenv\\nakambe_2022\\output\\water_detect_test",
shape_file="C:\\Users\\david\\Documents\\py\\myenv\\nakambe_2022\\spatial_extent.shp",
single_mode=True,
product='S2_S2COR'
)
or this :
input_folder="C:\\Users\\david\\Documents\\py\\myenv\\nakambe_2022\\S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE"
output_folder="C:\\Users\\david\\Documents\\py\\myenv\\nakambe_2022\\output\\water_detect_test"
os.makedirs(output_folder, exist_ok=True)
shape_file="C:\\Users\\david\\Documents\\py\\myenv\\nakambe_2022\\spatial_extent.shp"
water_mask = wd.DWWaterDetect.run_water_detect(input_folder=input_folder,
output_folder=output_folder,
shape_file=shape_file,
single_mode=True,
product='S2_S2COR'
)
but it seems it can't clip :
Copying [C:\Users\david\Documents\py\myenv\Lib\site-packages\WaterDetect.ini](file:///C:/Users/david/Documents/py/myenv/Lib/site-packages/WaterDetect.ini) into current dir.
WaterDetect.ini copied into [c:\Users\david\Documents\py\myenv\nakambe_2022.](file:///C:/Users/david/Documents/py/myenv/nakambe_2022.)
Loading configuration file WaterDetect.ini
File WaterDetect.ini verified.
Folder [C:\Users\david\Documents\py\myenv\nakambe_2022\S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE](file:///C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE) verified.
File [C:\Users\david\Documents\py\myenv\nakambe_2022\spatial_extent.shp](file:///C:/Users/david/Documents/py/myenv/nakambe_2022/spatial_extent.shp) verified.
Folder [C:\Users\david\Documents\py\myenv\nakambe_2022\output\water_detect_test](file:///C:/Users/david/Documents/py/myenv/nakambe_2022/output/water_detect_test) verified.
Starting WaterDetection version: 1.5.15
Opening image in folder [C:\Users\david\Documents\py\myenv\nakambe_2022\S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE](file:///C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE)
Retrieving bands for product S2_S2COR
35 were found:
Loading band: Blue
Loading band: Green
Loading band: Red
Loading band: Mir
Loading band: Mir2
Loading band: RedEdg1
Loading band: RedEdg2
Loading band: RedEdg3
Loading band: Nir
Loading band: Nir2
****** ERROR ********
'NoneType' object has no attribute 'FlushCache'
Without the clipping option, it ran for an hour and crashed due to lack of ram:
Copying C:\Users\david\Documents\py\myenv\Lib\site-packages\WaterDetect.ini into current dir.Loading configuration file WaterDetect.ini
WaterDetect.ini copied into c:\Users\david\Documents\py\myenv\nakambe_2022.
File WaterDetect.ini verified.
Folder C:\Users\david\Documents\py\myenv\nakambe_2022\S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE verified.
Folder C:\Users\david\Documents\py\myenv\nakambe_2022\output\water_detect_test verified.
Starting WaterDetection version: 1.5.15
Opening image in folder C:\Users\david\Documents\py\myenv\nakambe_2022\S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE
Retrieving bands for product S2_S2COR
35 were found:
Loading band: Blue
Loading band: Green
Loading band: Red
Loading band: Mir
Loading band: Mir2
Loading band: RedEdg1
Loading band: RedEdg2
Loading band: RedEdg3
Loading band: Nir
Loading band: Nir2
Invalid pixels (0.04494427689357368) < maximum (0.95).
Saving final MASK
Saving image: C:/Users/david/Documents/py/myenv/nakambe_2022/output/water_detect_test/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200_invalid_mask.tif
Calculating water mask in single mode. Just the first band_combination is processed
Calculating clusters for the following combination of bands:
['mndwi', 'ndwi', 'Mir2']
Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).
Selection of best number of clusters using Calinski-Harabasz Index:
**** ERROR DURING CLUSTERING ****
unable to allocate array data
Also,
bands=loader.get_bands_files()
gave me
FileNotFoundError: [WinError 3] Le chemin d’accès spécifié est introuvable: 'C:\\Users\\david\\Documents\\py\\myenv\\nakambe_2022\\S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE\\AUX_DATA\\GRANULE
which is curious because I didn't specified ...SAFE\\AUX_DATA\\GRANULE
.
It seems it can't browse correctly. If I delete the \\AUX_DATA
folder, then the same error occured but with another path that wasn't specified neither : ...SAFE\\DATASTRIP\\GRANULE
, it just tried to reach a folder \\GRANULE
in the first folder in the folder \\...SAFE
.
I tried also those:
import waterdetect as wd
from pathlib import Path
input_folder=Path("C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE")
loader=wd.InputOutput.DWLoader(input_folder=input_folder, product='S2_S2COR' )
Folder C:\Users\david\Documents\py\myenv\nakambe_2022\S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE verified.
!dir "C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE"
Le volume dans le lecteur C s'appelle Windows-SSD
Le num�ro de s�rie du volume est 9417-7BFA
R�pertoire de C:\Users\david\Documents\py\myenv\nakambe_2022\S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE
30-12-23 18:29 <DIR> .
04-01-24 15:11 <DIR> ..
06-06-22 18:40 <DIR> AUX_DATA
06-06-22 18:40 <DIR> DATASTRIP
06-06-22 18:40 <DIR> GRANULE
06-06-22 18:40 <DIR> HTML
06-06-22 18:37 18.628 INSPIRE.xml
06-06-22 18:37 96.247 manifest.safe
06-06-22 18:37 53.370 MTD_MSIL2A.xml
06-06-22 18:40 <DIR> rep_info
06-06-22 18:40 42.484 S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200-ql.jpg
4 fichier(s) 210.729 octets
7 R�p(s) 9.808.646.144 octets libres
import os
print(os.listdir(input_folder))
from pathlib import Path
p = Path(input_folder)
print([x for x in p.iterdir() if x.is_dir()])
['AUX_DATA', 'DATASTRIP', 'GRANULE', 'HTML', 'INSPIRE.xml', 'manifest.safe', 'MTD_MSIL2A.xml', 'rep_info', 'S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200-ql.jpg']
[WindowsPath('C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE/AUX_DATA'), WindowsPath('C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE/DATASTRIP'), WindowsPath('C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE/GRANULE'), WindowsPath('C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE/HTML'), WindowsPath('C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE/rep_info')]
loader.images
[WindowsPath('C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE/AUX_DATA'),
WindowsPath('C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE/DATASTRIP'),
WindowsPath('C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE/GRANULE'),
WindowsPath('C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE/HTML'),
WindowsPath('C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE/rep_info')]
img_folder=loader.current_image_folder
img_folder
WindowsPath('C:/Users/david/Documents/py/myenv/nakambe_2022/S2A_MSIL2A_20220101T102431_N0301_R065_T30PZU_20220101T133200.SAFE/AUX_DATA')
[str(f) for f in img_folder.iterdir()]
[]
Any idea?
Thanx,
David
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.