[Git][debian-gis-team/xarray-safe-s1][upstream] New upstream version 2025.12.4
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Fri Dec 5 08:56:39 GMT 2025
Antonio Valentino pushed to branch upstream at Debian GIS Project / xarray-safe-s1
Commits:
8191bac6 by Antonio Valentino at 2025-12-05T08:46:30+00:00
New upstream version 2025.12.4
- - - - -
15 changed files:
- .github/dependabot.yml
- .github/workflows/ci.yaml
- .github/workflows/publish.yml
- .github/workflows/upstream-dev.yaml
- README.md
- ci/requirements/docs.yaml
- docs/_static/css/xsar.css
- docs/examples/simple_tutorial.ipynb
- highleveltests/open_GRD_IW.py
- highleveltests/open_SLC_IW.py
- highleveltests/open_SLC_IW_S3.py
- safe_s1/__init__.py
- safe_s1/reader.py
- safe_s1/sentinel1_xml_mappings.py
- test/test_s1reader.py
Changes:
=====================================
.github/dependabot.yml
=====================================
@@ -3,4 +3,4 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
- interval: "weekly"
\ No newline at end of file
+ interval: "weekly"
=====================================
.github/workflows/ci.yaml
=====================================
@@ -23,7 +23,7 @@ jobs:
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- - uses: actions/checkout at v5
+ - uses: actions/checkout at v6
with:
fetch-depth: 2
- uses: xarray-contrib/ci-trigger at v1
@@ -50,7 +50,7 @@ jobs:
steps:
- name: Checkout the repository
- uses: actions/checkout at v5
+ uses: actions/checkout at v6
with:
# need to fetch all tags to get a correct version
fetch-depth: 0 # fetch all branches and tags
=====================================
.github/workflows/publish.yml
=====================================
@@ -12,7 +12,7 @@ jobs:
contents: "read"
id-token: "write"
steps:
- - uses: actions/checkout at v5
+ - uses: actions/checkout at v6
- name: Set up Python
uses: actions/setup-python at v6
with:
=====================================
.github/workflows/upstream-dev.yaml
=====================================
@@ -21,7 +21,7 @@ jobs:
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- - uses: actions/checkout at v5
+ - uses: actions/checkout at v6
with:
fetch-depth: 2
- uses: xarray-contrib/ci-trigger at v1.2
@@ -55,7 +55,7 @@ jobs:
steps:
- name: checkout the repository
- uses: actions/checkout at v5
+ uses: actions/checkout at v6
with:
# need to fetch all tags to get a correct version
fetch-depth: 0 # fetch all branches and tags
=====================================
README.md
=====================================
@@ -1,17 +1,14 @@
-
[](https://xarray-safe-s1.readthedocs.io/en/latest/?badge=latest)
# xarray-safe-s1
Xarray Sentinel1 python SAFE files reader
-
-
# Install
## Conda
-1) Install xarray-safe-s1
+1. Install xarray-safe-s1
```
conda create -n safe_s1
@@ -19,10 +16,9 @@ conda activate safe_s1
conda install -c conda-forge xarray-safe-s1
```
-
## Pypi
-1) Install xarray-safe-s1
+1. Install xarray-safe-s1
```
conda create -n safe_s1
@@ -30,7 +26,6 @@ conda activate safe_s1
pip install xarray-safe-s1
```
-
```pycon
>>> from safe_s1 import Sentinel1Reader, sentinel1_xml_mappings
>>> filename = sentinel1_xml_mappings.get_test_file('S1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_Z010.SAFE')
@@ -115,7 +110,7 @@ DataTree('None', parent=None)
│ Dimensions: (burst: 0)
│ Dimensions without coordinates: burst
│ Data variables:
-│ azimuthTime (burst) float64
+│ azimuthTime (burst) float64
│ linesPerBurst int64 0
│ samplesPerBurst int64 0
│ Attributes:
@@ -132,13 +127,13 @@ DataTree('None', parent=None)
├── DataTree('noise_azimuth_raw')
│ Dimensions: (swath: 0, pol: 2)
│ Coordinates:
-│ * swath (swath) float64
+│ * swath (swath) float64
│ * pol (pol) object 'VV' 'VH'
│ Data variables:
-│ line_start (pol, swath) int64
-│ line_stop (pol, swath) int64
-│ sample_start (pol, swath) int64
-│ sample_stop (pol, swath) int64
+│ line_start (pol, swath) int64
+│ line_stop (pol, swath) int64
+│ sample_start (pol, swath) int64
+│ sample_stop (pol, swath) int64
│ Attributes:
│ history: noise_lut_azi_raw_grd:\n annotation/calibration/noise.xml:\n ...
└── DataTree('noise_range_raw')
=====================================
ci/requirements/docs.yaml
=====================================
@@ -12,4 +12,4 @@ dependencies:
- aiohttp
- pip
- pip:
- - -e ../..
\ No newline at end of file
+ - -e ../..
=====================================
docs/_static/css/xsar.css
=====================================
@@ -1,9 +1,8 @@
@import url("theme.css");
.wy-nav-content {
- max-width: 1000px !important;
+ max-width: 1000px !important;
}
dl.py.property {
- display: block !important;
+ display: block !important;
}
-
=====================================
docs/examples/simple_tutorial.ipynb
=====================================
@@ -38,7 +38,9 @@
"outputs": [],
"source": [
"# get test file. You can replace with an path to other SAFE\n",
- "filename = sentinel1_xml_mappings.get_test_file('S1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_Z010.SAFE')\n",
+ "filename = sentinel1_xml_mappings.get_test_file(\n",
+ " \"S1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_Z010.SAFE\"\n",
+ ")\n",
"filename"
]
},
@@ -79,7 +81,7 @@
"metadata": {},
"outputs": [],
"source": [
- "# Type of product \n",
+ "# Type of product\n",
"reader.product"
]
},
@@ -307,8 +309,8 @@
"source": [
"# parameters\n",
"resampling = rasterio.enums.Resampling.rms\n",
- "chunks = {'line': 5000, 'sample': 5000}\n",
- "resolution = '1000m'"
+ "chunks = {\"line\": 5000, \"sample\": 5000}\n",
+ "resolution = \"1000m\""
]
},
{
@@ -318,7 +320,9 @@
"metadata": {},
"outputs": [],
"source": [
- "dn = reader.load_digital_number(resolution=resolution, resampling=resampling, chunks=chunks)\n",
+ "dn = reader.load_digital_number(\n",
+ " resolution=resolution, resampling=resampling, chunks=chunks\n",
+ ")\n",
"dn"
]
},
@@ -412,7 +416,7 @@
"outputs": [],
"source": [
"# Unlock the safety\n",
- "reader._dict['geolocationGrid'] = None\n",
+ "reader._dict[\"geolocationGrid\"] = None\n",
"# Load the geolocation grid dataset\n",
"reader.geoloc"
]
@@ -437,11 +441,6 @@
}
],
"metadata": {
- "kernelspec": {
- "display_name": "Python 3 (ipykernel)",
- "language": "python",
- "name": "python3"
- },
"language_info": {
"codemirror_mode": {
"name": "ipython",
@@ -451,8 +450,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.10.8"
+ "pygments_lexer": "ipython3"
}
},
"nbformat": 4,
=====================================
highleveltests/open_GRD_IW.py
=====================================
@@ -1,23 +1,24 @@
-import pdb
-from safe_s1 import Sentinel1Reader, getconfig
-import time
import logging
+import time
+
+from safe_s1 import Sentinel1Reader, getconfig
+
logging.basicConfig(level=logging.DEBUG)
-logging.debug('start GRD test')
+logging.debug("start GRD test")
conf = getconfig.get_config()
-subswath = conf['product_paths'][0]
+subswath = conf["product_paths"][0]
print(subswath)
t0 = time.time()
-if 'GRD' in subswath:
+if "GRD" in subswath:
sub_reader = Sentinel1Reader(subswath)
else:
- sub_reader = Sentinel1Reader('SENTINEL1_DS:'+subswath+':IW3')
-elapse_t = time.time()-t0
+ sub_reader = Sentinel1Reader("SENTINEL1_DS:" + subswath + ":IW3")
+elapse_t = time.time() - t0
dt = sub_reader.datatree
-print('out of the reader')
+print("out of the reader")
print(dt)
-print('time to read the SAFE through nfs: %1.2f sec'%elapse_t)
-DN = sub_reader.load_digital_number(chunks={'pol':'VV','line':6000,'sample':8000})
-print('DN',DN)
+print("time to read the SAFE through nfs: %1.2f sec" % elapse_t)
+DN = sub_reader.load_digital_number(chunks={"pol": "VV", "line": 6000, "sample": 8000})
+print("DN", DN)
# pdb.set_trace()
=====================================
highleveltests/open_SLC_IW.py
=====================================
@@ -1,15 +1,17 @@
import pdb
-from safe_s1 import Sentinel1Reader, getconfig
import time
+
+from safe_s1 import Sentinel1Reader, getconfig
+
conf = getconfig.get_config()
-subswath = conf['nfs_iw_grd_path']
+subswath = conf["nfs_iw_grd_path"]
print(subswath)
t0 = time.time()
sub_reader = Sentinel1Reader(subswath)
-elapse_t = time.time()-t0
+elapse_t = time.time() - t0
dt = sub_reader.datatree
-print('out of the reader')
+print("out of the reader")
print(dt)
-print('time to read the SAFE through nfs: %1.2f sec'%elapse_t)
+print("time to read the SAFE through nfs: %1.2f sec" % elapse_t)
pdb.set_trace()
=====================================
highleveltests/open_SLC_IW_S3.py
=====================================
@@ -1,36 +1,50 @@
-# see https://stackoverflow.com/questions/69624867/no-such-file-error-when-trying-to-create-local-cache-of-s3-object
-from safe_s1 import Sentinel1Reader,getconfig
-import pdb
-import os
-import time
import logging
+import time
+
import fsspec
+
+# see https://stackoverflow.com/questions/69624867/no-such-file-error-when-trying-to-create-local-cache-of-s3-object
+from safe_s1 import Sentinel1Reader, getconfig
+
logging.basicConfig(level=logging.INFO)
-logging.info('test start')
+logging.info("test start")
conf = getconfig.get_config()
-access_key = conf['access_key']
-secret_key = conf['secret_key']
-entrypoint_url = conf['entrypoint_url']
-s3 = fsspec.filesystem("s3", anon=False,
- key=access_key,
- secret=secret_key,
- endpoint_url='https://'+entrypoint_url)
+access_key = conf["access_key"]
+secret_key = conf["secret_key"]
+entrypoint_url = conf["entrypoint_url"]
+s3 = fsspec.filesystem(
+ "s3",
+ anon=False,
+ key=access_key,
+ secret=secret_key,
+ endpoint_url="https://" + entrypoint_url,
+)
# this syntaxe works we can get content xml files but I would have to precise which subswath I want to decode in case of SLC
# safe2 = 's3:///eodata/Sentinel-1/SAR/SLC/2019/10/13/S1B_IW_SLC__1SDV_20191013T155948_20191013T160015_018459_022C6B_13A2.SAFE'
-safe2 = 's3:///eodata/Sentinel-1/SAR/IW_GRDH_1S/2024/04/18/S1A_IW_GRDH_1SSH_20240418T080141_20240418T080210_053485_067D74_C073.SAFE'
+safe2 = "s3:///eodata/Sentinel-1/SAR/IW_GRDH_1S/2024/04/18/S1A_IW_GRDH_1SSH_20240418T080141_20240418T080210_053485_067D74_C073.SAFE"
# safe2 = conf['s3_iw_grd_path']
-option = 'kwargs'
-if option == 'kwargs':
- storage_options = {"anon": False, "client_kwargs": {"endpoint_url": 'https://'+entrypoint_url, 'aws_access_key_id':access_key,
- 'aws_secret_access_key':secret_key}}
+option = "kwargs"
+if option == "kwargs":
+ storage_options = {
+ "anon": False,
+ "client_kwargs": {
+ "endpoint_url": "https://" + entrypoint_url,
+ "aws_access_key_id": access_key,
+ "aws_secret_access_key": secret_key,
+ },
+ }
t0 = time.time()
- sub_reader = Sentinel1Reader(safe2,backend_kwargs={"storage_options": storage_options})
- elapse_t = time.time()-t0
- print('time to read the SAFE through S3: %1.2f sec'%elapse_t)
+ sub_reader = Sentinel1Reader(
+ safe2, backend_kwargs={"storage_options": storage_options}
+ )
+ elapse_t = time.time() - t0
+ print("time to read the SAFE through S3: %1.2f sec" % elapse_t)
else:
# this solution is not supported.
- sub_reader = Sentinel1Reader(s3.get_mapper(safe2)) # botocore.errorfactory.NoSuchKey: An error occurred (NoSuchKey) when calling the GetObject operation: Unknown
+ sub_reader = Sentinel1Reader(
+ s3.get_mapper(safe2)
+ ) # botocore.errorfactory.NoSuchKey: An error occurred (NoSuchKey) when calling the GetObject operation: Unknown
dt = sub_reader.datatree
-print('out of the reader')
+print("out of the reader")
print(dt)
=====================================
safe_s1/__init__.py
=====================================
@@ -1,4 +1,5 @@
import traceback
+
from safe_s1.reader import Sentinel1Reader
try:
=====================================
safe_s1/reader.py
=====================================
@@ -1,6 +1,5 @@
import logging
import os
-import pdb
import re
import dask
=====================================
safe_s1/sentinel1_xml_mappings.py
=====================================
@@ -779,14 +779,14 @@ def df_files(annotation_files, measurement_files, noise_files, calibration_files
for f in annotation_files
]
dsid = [os.path.basename(f).split("-")[1].upper() for f in annotation_files]
-
# check that dsid are spatialy uniques (i.e. there is only one dsid per geographic position)
# some SAFES like WV, dsid are not uniques ('WV1' and 'WV2')
# we want them uniques, and compatibles with gdal sentinel driver (ie 'WV_012')
pols_count = len(set(pols))
subds_count = len(annotation_files) // pols_count
dsid_count = len(set(dsid))
- if dsid_count != subds_count:
+ # if dsid_count != subds_count:
+ if "WV" in dsid[0]:
dsid_rad = dsid[0][:-1] # WV
dsid = ["%s_%03d" % (dsid_rad, n) for n in num]
assert (
=====================================
test/test_s1reader.py
=====================================
@@ -1,15 +1,18 @@
-from safe_s1 import sentinel1_xml_mappings, Sentinel1Reader, getconfig
import logging
+from safe_s1 import Sentinel1Reader, getconfig, sentinel1_xml_mappings
logging.basicConfig()
logging.captureWarnings(True)
-logger = logging.getLogger('s1_reader_test')
+logger = logging.getLogger("s1_reader_test")
logger.setLevel(logging.DEBUG)
conf = getconfig.get_config()
-products = [sentinel1_xml_mappings.get_test_file(filename) for filename in conf['product_paths']]
+products = [
+ sentinel1_xml_mappings.get_test_file(filename) for filename in conf["product_paths"]
+]
+
# Try to apply the reader on different products
def test_reader():
@@ -23,11 +26,5 @@ def test_reader():
for ds in dt:
dt[ds].to_dataset().compute()
assert True
- except:
+ except IOError:
assert False
-
-
-
-
-
-
View it on GitLab: https://salsa.debian.org/debian-gis-team/xarray-safe-s1/-/commit/8191bac60e56f4c81b49686fe29243e3c237a77b
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/xarray-safe-s1/-/commit/8191bac60e56f4c81b49686fe29243e3c237a77b
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/20251205/7460beb7/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list