From 60539addc820ba2c5c6601f2d978c388a385a213 Mon Sep 17 00:00:00 2001 From: Sieger Falkena Date: Wed, 18 Sep 2024 08:22:25 +0200 Subject: [PATCH] add refresh_samples function --- torchgeo/samplers/single.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/torchgeo/samplers/single.py b/torchgeo/samplers/single.py index 1a7f1d70f31..ae82a82f167 100644 --- a/torchgeo/samplers/single.py +++ b/torchgeo/samplers/single.py @@ -269,6 +269,14 @@ def __init__( self.chips = self.get_chips() + def refresh_samples(self) -> None: + """Refresh the samples in the sampler. + + This method is useful when you want to refresh the random samples in the sampler + without creating a new sampler instance. + """ + self.chips = self.get_chips() + def get_chips(self) -> GeoDataFrame: """Generate chips from the dataset.