[Git][debian-gis-team/xsar][upstream] New upstream version 2025.06.12
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sun Aug 10 18:15:45 BST 2025
Antonio Valentino pushed to branch upstream at Debian GIS Project / xsar
Commits:
2f5b3ce5 by Antonio Valentino at 2025-08-09T16:00:19+00:00
New upstream version 2025.06.12
- - - - -
3 changed files:
- .git_archival.txt
- src/xsar/sentinel1_dataset.py
- src/xsar/utils.py
Changes:
=====================================
.git_archival.txt
=====================================
@@ -1 +1 @@
-ref-names: HEAD -> develop, tag: v1.1.9, tag: v1.1.10, tag: 2025.03.07
\ No newline at end of file
+ref-names: HEAD -> develop, tag: 2025.06.12
\ No newline at end of file
=====================================
src/xsar/sentinel1_dataset.py
=====================================
@@ -238,18 +238,26 @@ class Sentinel1Dataset(BaseDataset):
# apply recalibration ?
self.apply_recalibration = recalibration
+ if self.apply_recalibration & ("auxiliary_dir" not in config or config['auxiliary_dir'] is None):
+ raise ValueError(
+ "config['auxiliary_dir'] is None or not in config."
+ "You can set it to a valid path in your xsar config file."
+ )
+
if self.apply_recalibration and (
self.sar_meta.swath != "EW" and self.sar_meta.swath != "IW"
):
- self.apply_recalibration = False
raise ValueError(
f"Recalibration in only done for EW/IW modes. You have '{self.sar_meta.swath}'. apply_recalibration is set to False."
)
+ if self.apply_recalibration and (not os.path.exists(config['auxiliary_dir']) or not os.path.exists(config['path_dataframe_aux'])):
+ raise ValueError(
+ f"Check if config['auxiliary_dir'] is set to a valid path in your xsar config file. It should contain the auxiliary files needed for recalibration.\n\
+ Also check if config['path_dataframe_aux'] is set to a valid path in your xsar config file.")
if self.apply_recalibration and np.all(
np.isnan(self.datatree.antenna_pattern["roll"].values)
):
- self.apply_recalibration = False
raise ValueError(
f"Recalibration can't be done without roll angle. You probably work with an old file for which roll angle is not in auxiliary file.")
@@ -366,7 +374,7 @@ class Sentinel1Dataset(BaseDataset):
patch_variable=patch_variable, luts=luts, lazy_loading=lazyloading
)
if self.apply_recalibration:
- self.select_gains()
+ self.select_gains_for_recalibration()
self.apply_calibration_and_denoising()
# added 6 fev 23, to fill empty attrs
@@ -426,7 +434,7 @@ class Sentinel1Dataset(BaseDataset):
res.attrs["corrected_range_noise_lut"] = "shift : %i lines" % line_shift
return res
- def select_gains(self):
+ def select_gains_for_recalibration(self):
"""
attribution of the good swath gain by getting the swath number of each pixel
@@ -630,15 +638,7 @@ class Sentinel1Dataset(BaseDataset):
if "GRD" in str(self.datatree.attrs["product"]):
self.add_swath_number()
- path_aux_cal_old = get_path_aux_cal(
- self.sar_meta.manifest_attrs["aux_cal"]
- )
-
- path_aux_pp1_old = get_path_aux_pp1(
- self.sar_meta.manifest_attrs["aux_pp1"]
- )
-
- if self.apply_recalibration == False:
+ if self.apply_recalibration is False:
new_cal = "None"
new_pp1 = "None"
@@ -646,6 +646,14 @@ class Sentinel1Dataset(BaseDataset):
path_dataframe_aux = config["path_dataframe_aux"]
dataframe_aux = pd.read_csv(path_dataframe_aux)
+ path_aux_cal_old = get_path_aux_cal(
+ self.sar_meta.manifest_attrs["aux_cal"]
+ )
+
+ path_aux_pp1_old = get_path_aux_pp1(
+ self.sar_meta.manifest_attrs["aux_pp1"]
+ )
+
sel_cal = dataframe_aux.loc[(dataframe_aux.sat_name == self.sar_meta.manifest_attrs['satellite']) &
(dataframe_aux.aux_type == "CAL") &
(dataframe_aux.icid == int(self.sar_meta.manifest_attrs['icid'])) &
=====================================
src/xsar/utils.py
=====================================
@@ -40,20 +40,26 @@ except ImportError:
def _load_config():
"""
- load config from default xsar/config.yml file or user ~/.xsar/config.yml
+ Load configuration from ~/.xsar/config.yml if it exists,
+ otherwise fall back to the default xsar/config.yml.
+
Returns
-------
dict
+ Configuration dictionary. Returns a dictionary with 'data_dir' set to '/tmp'
"""
- user_config_file = Path("~/.xsar/config.yml").expanduser()
- default_config_file = files("xsar").joinpath("config.yml")
+ user_config = Path("~/.xsar/config.yml").expanduser()
+ default_config = files("xsar").joinpath("config.yml")
+ config_file = user_config if user_config.exists() else default_config
- if user_config_file.exists():
- config_file = user_config_file
- else:
- config_file = default_config_file
+ try:
+ with config_file.open() as f:
+ config = yaml.safe_load(f) or {'data_dir': '/tmp'}
+ except yaml.YAMLError as e:
+ logger.error("Failed to load config from %s: %s", config_file, e)
+ raise FileNotFoundError(
+ f"Configuration file {config_file} is not readable or empty")
- config = yaml.load(config_file.open(), Loader=yaml.FullLoader)
return config
View it on GitLab: https://salsa.debian.org/debian-gis-team/xsar/-/commit/2f5b3ce503d6771d98e38c563a8d77e6ccbfb460
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/xsar/-/commit/2f5b3ce503d6771d98e38c563a8d77e6ccbfb460
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20250810/1d29c40a/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list