Comments (4)
The timestamps are saved in eopatch_ecc.timestamp
, so I would suggest you actually pass a list of names to the export task so that you will get one tiff file for each timestamp, with the filename being the timestamps.
Something like this
filenames = [f"ts.strftime('%Y%m%dT%H%M%S').tiff" for ts in eopatch_ecc.timestamp]
export_task.execute(eopatch_ecc, filename=filenames)
from eo-learn.
Hi @NourSoltani
What you are after is the ExportToTiffTask
, which allows you to export each timeframe to a tiff. Read the documentation to set the arguments correctly.
Let me know if it works.
from eo-learn.
Hi @devisperessutti
Thank you for the quick responding. I appreciate
Yes it works!! It fits well with my expectations..
But I still have a problem If you do not mind..
There's the full code:
#################################################################
#################################################################
Enhanced Cross-Correlation
params = {"MaxIters": 200}
coregister_ecc = ECCRegistrationTask(feat_bands, channel=2, params=params)
eopatch_ecc = coregister_ecc(eopatch_clean)
export_task = ExportToTiffTask((FeatureType.DATA, "BANDS"), folder="/home/Desktop/Nour/eo-learn-examples-main/coregistration/test/")
export_task.execute(eopatch_ecc,filename="temp_file_ecc.tiff")
with rasterio.open("temp_file_ecc.tiff") as src:
Get the number of bands in the image
num_bands = src.count
Iterate through the bands in groups of 3
for i in range(0, num_bands, 3):
#Read in the current group of 3 bands
band = src.read(indexes=range(i+3, i,-1))
Save the current group of 3 bands as a new image
with rasterio.open(f"image_{i//3}.tif", "w", driver="GTiff",
width=src.width, height=src.height,
count=3, dtype=band.dtype, crs=src.crs, transform=src.transform) as dst:
dst.write(band)
print(band)
#################################################################
#################################################################
As I said, I still have a problem If you do not mind.. I need to know the date of each timestamp. Is there any method on how to figure out the chosen dates? Because he has downloaded the images this way:
roi_bbox = BBox(bbox=[31.112895, 29.957240, 31.154222, 29.987687], crs=CRS.WGS84)
time_interval = ("2018-01-01", "2020-06-01")
feat_bands = (FeatureType.DATA, "BANDS")
class MaxCloudCoveragePredicate:
def init(self, max_cloud_coverage: float):
self.max_cloud_coverage = max_cloud_coverage
def call(self, cloud_mask: np.ndarray):
width, height, _ = cloud_mask.shape
cloud_coverage = np.sum(cloud_mask) / (width * height)
return cloud_coverage <= self.max_cloud_coverage
download_task = SentinelHubInputTask(
data_collection=DataCollection.SENTINEL2_L1C,
bands_feature=feat_bands,
resolution=10,
maxcc=0.5,
bands=["B02", "B03", "B04"],
time_difference=datetime.timedelta(hours=2),
additional_data=[(FeatureType.MASK, "dataMask", "IS_DATA"), (FeatureType.MASK, "CLM")],
)
filter_clouds = SimpleFilterTask((FeatureType.MASK, "CLM"), MaxCloudCoveragePredicate(max_cloud_coverage=0.05))
from eo-learn.
Thank you very much!
I really appreciate your help..
Of course without forgetting the {}: {ts.strftime('%Y%m%dT%H%M%S')}
:)
from eo-learn.
Related Issues (20)
- [BUG] ImportError: cannot import name 'PointSamplingTask' from 'eolearn.geometry' HOT 5
- SI_LULC_pipeline notebook HOT 9
- readthedocs links not working HOT 1
- [FEAT] Enable timestamp filtering from interval end towards interval start HOT 5
- [BUG] SentinelHubInputTask downloads incorrect timestamps HOT 6
- [BUG] Issue with the SpatialResizeTask in ImportTiffPipeline when using the resolution approach HOT 5
- [BUG] eo-learn installation issue due to open-cv latest update on Dec 30, 2022. HOT 2
- [BUG] Failing tests on MacOS related to lock-related EOExecutor tests HOT 1
- [BUG] Reading EOPatches saved with eo-learn 0.10.1 with eolearn 1.4 HOT 2
- [HELP] Where has eopatch_to_dataset gone? HOT 6
- [FEAT] TDigestTask handle nans HOT 1
- [HELP] Error when I'm trying to run land-cover-map HOT 5
- [HELP] Perform sen2cor atmospheric correction on L1C EOPatch HOT 2
- [HELP] Using eo-learn for the classification of land surface types of Ukraine HOT 23
- Why I have problems with these imports? HOT 3
- ExecutableNotFound: failed to execute WindowsPath('dot'), make sure the Graphviz executables are on your systems' PATH HOT 3
- how do i fix this HOT 2
- CRSError in rasterio when using ExportToTiffTask HOT 6
- `eo-learn` 1.5.0 migration guide
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eo-learn.