Skip to content

Commit dda3ef9

Browse files
committed
adjust string serialization to be closer to the corresponding attribute names
1 parent a85f39b commit dda3ef9

3 files changed

Lines changed: 85 additions & 86 deletions

File tree

README.md

Lines changed: 37 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,33 @@ print(cov)
5656
```yaml
5757
dominant_leaf_type_20m:
5858
subtype: ReferenceableGridCoverage
59-
native CRS: OGC:AnsiDate+EPSG:3035
60-
geo bbox:
59+
crs: OGC:AnsiDate+EPSG:3035
60+
bbox:
6161
time:
62-
min: "2012-01-01"
63-
max: "2015-01-01"
62+
low: "2012-01-01"
63+
high: "2015-01-01"
6464
crs: OGC:AnsiDate
6565
Y:
66-
min: 900000
67-
max: 5500000
66+
low: 900000
67+
high: 5500000
6868
crs: EPSG:3035
6969
X:
70-
min: 900000
71-
max: 7400000
70+
low: 900000
71+
high: 7400000
7272
crs: EPSG:3035
73-
lon/lat bbox:
73+
WGS84 bbox:
7474
Lon:
75-
min: -56.50514190170437
76-
max: 72.9061049341568
75+
low: -56.50514190170437
76+
high: 72.9061049341568
7777
crs: EPSG:4326
7878
Lat:
79-
min: 24.28417068794856
80-
max: 72.66326966834436
79+
low: 24.28417068794856
80+
high: 72.66326966834436
8181
crs: EPSG:4326
8282
size in bytes: 113000000001
8383
additional params:
8484
title: Dominant Leaf Type (2012-2015)
85-
sizeInBytesWithPyramidLevels: "113000000001"
85+
sizeInBytesWithPyramidLevels: 122417133472
8686
```
8787
8888
Examples for extracting individual details of the coverage:
@@ -153,62 +153,53 @@ cov = service.list_full_info('dominant_leaf_type_20m')
153153

154154
print(cov)
155155
```
156-
```yaml
157-
dominant_leaf_type_20m:
158-
native CRS: OGC:AnsiDate+EPSG:3035
159-
geo bbox:
156+
```yamldominant_leaf_type_20m:
157+
crs: OGC:AnsiDate+EPSG:3035
158+
bbox:
160159
time:
161-
min: 2012-01-01
162-
max: 2015-01-01
160+
low: "2012-01-01"
161+
high: "2015-01-01"
163162
crs: OGC:AnsiDate
164163
uom: d
165164
type: irregular
166-
coefficients:
167-
- 2012-01-01
168-
- 2015-01-01
165+
coefficients: ["2012-01-01", "2015-01-01"]
169166
Y:
170-
min: 900000
171-
max: 5500000
167+
low: 900000
168+
high: 5500000
172169
crs: EPSG:3035
173170
uom: metre
174-
resolution: -20
171+
resolution: -20.0
175172
type: regular
176173
X:
177-
min: 900000
178-
max: 7400000
174+
low: 900000
175+
high: 7400000
179176
crs: EPSG:3035
180177
uom: metre
181-
resolution: 20
178+
resolution: 20.0
182179
type: regular
183-
grid bbox:
180+
grid_bbox:
184181
i:
185-
min: 0
186-
max: 1
182+
low: 0
183+
high: 1
187184
resolution: 1
188185
type: regular
189186
j:
190-
min: -125000
191-
max: 104999
187+
low: -125000
188+
high: 104999
192189
resolution: 1
193190
type: regular
194191
k:
195-
min: 0
196-
max: 324999
192+
low: 0
193+
high: 324999
197194
resolution: 1
198195
type: regular
199-
range type fields:
196+
range_type:
200197
dlt:
201198
type: Category
202199
label: dominant leaf type map of Europe
203-
description: >
204-
raster coding (thematic pixel values):
205-
0: all non-tree covered areas;
206-
1: broadleaved trees;
207-
2: coniferous trees;
208-
254: unclassifiable (no satellite image available, or clouds, shadows, or snow);
209-
255: outside area
200+
description: raster coding (thematic pixel values): 0: all non-tree covered areas; 1: broadleaved trees; 2: coniferous trees; 254: unclassifiable (no satellite image available, or clouds, shadows, or snow); 255: outside area
210201
definition: https://land.copernicus.eu/en/technical-library/hrl-forest-2012-2015/@@download/file
211-
nil values: 250
202+
nil_values: 250
212203
metadata:
213204
covMetadata:
214205
axes:
@@ -225,7 +216,7 @@ dominant_leaf_type_20m:
225216
catalog:
226217
title: Dominant Leaf Type (2012-2015)
227218
thumbnail: https://fairicube.rasdaman.com/rasdaman/ows/coverage/thumbnail?COVERAGEID=dominant_leaf_type_20m
228-
description: Provides at pan-European level in the spatial resolution of 20 m information on the dominant leaf type (broadleaved or coniferous).
219+
description: Provides at pan-European level in the spatial resolution of 20 m information on the dominant leaf type (broadleaved or coniferous). According to the 2020 State of Europe’s Forest report, approximately 70% of European forests are dominated by broadleaf deciduous trees while the remaining 30% are dominated by evergreen coniferous trees. Broadleaf and coniferous forests represent distinct habitat types and require different ecological considerations and management approaches. For example, coniferous forests are often more fire-resistant than broadleaf forests, but coniferous forests are also more vulnerable to infestations from insects such as bark beetles and processionary moths. There are also differences with regards to carbon storage and sequestration—broadleaf forests typically have higher tree density and larger average trunk diameter while coniferous forests have a longer growing season and deeper root systems. The High Resolution Layer Dominant Leaf Type product allows users to identify and track changes in the dominant leaf type of all European tree cover. This data can be used to monitor the health of ecosystems, identify areas experiencing high levels of deforestation or reforestation, manage natural resources, inform climate change mitigation strategies, and support biodiversity conservation efforts. Because this is a high resolution product, which covers the entirety of Europe, it can be used to inform policy decisions from the regional to the continental scale. The product is currently on a three-year update cycle, but in 2024 these will become annual, beginning from the 2019 reference year.
229220
provenance:
230221
"@sourceUrl": https://land.copernicus.eu/en/products/high-resolution-layer-dominant-leaf-type
231222
"@providerName": Copernicus

tests/test_service.py

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,28 @@ def test_list_coverages():
1919
cov = coverages['AvgLandTemp']
2020
expected = '''AvgLandTemp:
2121
subtype: ReferenceableGridCoverage
22-
native CRS: OGC:AnsiDate+EPSG:4326
23-
geo bbox:
22+
crs: OGC:AnsiDate+EPSG:4326
23+
bbox:
2424
ansi:
25-
min: "2000-02-01"
26-
max: "2015-06-01"
25+
low: "2000-02-01"
26+
high: "2015-06-01"
2727
crs: OGC:AnsiDate
2828
Lat:
29-
min: -90
30-
max: 90
29+
low: -90
30+
high: 90
3131
crs: EPSG:4326
3232
Lon:
33-
min: -180
34-
max: 180
33+
low: -180
34+
high: 180
3535
crs: EPSG:4326
36-
lon/lat bbox:
36+
WGS84 bbox:
3737
Lon:
38-
min: -180
39-
max: 180
38+
low: -180
39+
high: 180
4040
crs: EPSG:4326
4141
Lat:
42-
min: -90
43-
max: 90
42+
low: -90
43+
high: 90
4444
crs: EPSG:4326
4545
size in bytes: 4809618404'''
4646
assert str(cov) == expected
@@ -59,15 +59,23 @@ def test_list_coverages_all():
5959
assert not all(cov.is_local() for k, cov in coverages.items())
6060

6161

62+
# def test_list_coverages_readme():
63+
# service = WebCoverageService("https://fairicube.rasdaman.com/rasdaman/ows")
64+
# coverages = service.list_coverages()
65+
# # cov = coverages['dominant_leaf_type_20m']
66+
# cov = service.list_full_info('dominant_leaf_type_20m')
67+
# print(cov)
68+
69+
6270
def test_list_full_info():
6371
service = WebCoverageService("https://ows.rasdaman.org/rasdaman/ows")
6472
cov = service.list_full_info('AvgLandTemp')
6573
expected = '''AvgLandTemp:
66-
native CRS: OGC:AnsiDate+EPSG:4326
67-
geo bbox:
74+
crs: OGC:AnsiDate+EPSG:4326
75+
bbox:
6876
ansi:
69-
min: "2000-02-01"
70-
max: "2015-06-01"
77+
low: "2000-02-01"
78+
high: "2015-06-01"
7179
crs: OGC:AnsiDate
7280
uom: d
7381
type: irregular
@@ -99,41 +107,41 @@ def test_list_full_info():
99107
"2014-09-01", "2014-10-01", "2014-11-01", "2014-12-01", "2015-01-01", "2015-02-01", "2015-03-01",
100108
"2015-04-01", "2015-05-01", "2015-06-01"]
101109
Lat:
102-
min: -90
103-
max: 90
110+
low: -90
111+
high: 90
104112
crs: EPSG:4326
105113
uom: degree
106114
resolution: -0.1
107115
type: regular
108116
Lon:
109-
min: -180
110-
max: 180
117+
low: -180
118+
high: 180
111119
crs: EPSG:4326
112120
uom: degree
113121
resolution: 0.1
114122
type: regular
115-
grid bbox:
123+
grid_bbox:
116124
i:
117-
min: 0
118-
max: 184
125+
low: 0
126+
high: 184
119127
resolution: 1
120128
type: regular
121129
j:
122-
min: 0
123-
max: 1799
130+
low: 0
131+
high: 1799
124132
resolution: 1
125133
type: regular
126134
k:
127-
min: 0
128-
max: 3599
135+
low: 0
136+
high: 3599
129137
resolution: 1
130138
type: regular
131-
range type fields:
139+
range_type:
132140
Gray:
133141
type: Quantity
134142
label: Gray
135143
definition: http://www.opengis.net/def/dataType/OGC/0/float32
136-
nil values: 99999
144+
nil_values: 99999
137145
uom: 10^0
138146
metadata:
139147
covMetadata: None

wcs/model.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ def __str__(self):
5959
if self.bbox is not None:
6060
ret += f'\n{self.bbox}'
6161
if self.lon is not None:
62-
ret += f'\n lon/lat bbox:{self.lon}{self.lat}'
62+
ret += f'\n WGS84 bbox:{self.lon}{self.lat}'
6363
if self.size_bytes is not None:
6464
ret += f'\n size in bytes: {self.size_bytes}'
6565
if self.additional_params is not None and len(self.additional_params) > 0:
6666
additional_params = _dict_to_yaml(self.additional_params, 4)
67-
ret += f'\n additional params: {additional_params}'
67+
ret += f'\n additional params:\n{additional_params}'
6868
return ret
6969

7070
def is_local(self) -> bool:
@@ -159,8 +159,8 @@ def __str__(self):
159159
indent = '\n '
160160
ret = f'{indent}{self.name}:'
161161
indent += ' '
162-
ret += f'{indent}min: {_bound_to_str(self.low)}'
163-
ret += f'{indent}max: {_bound_to_str(self.high)}'
162+
ret += f'{indent}low: {_bound_to_str(self.low)}'
163+
ret += f'{indent}high: {_bound_to_str(self.high)}'
164164
if self.crs is not None:
165165
ret += f'{indent}crs: {Crs.to_short_notation(self.crs)}'
166166
if self.uom is not None:
@@ -303,12 +303,12 @@ def __init__(self, axes: list[Axis], crs: Optional[str]):
303303
self.crs = crs
304304

305305
def __str__(self):
306-
bbox_type = 'grid'
306+
bbox_type = 'grid_bbox'
307307
ret = ''
308308
if self.crs is not None:
309-
ret += f' native CRS: {Crs.to_short_notation(self.crs)}\n'
310-
bbox_type = 'geo'
311-
ret += f' {bbox_type} bbox:{_list_to_str(self.axes, "")}'
309+
ret += f' crs: {Crs.to_short_notation(self.crs)}\n'
310+
bbox_type = 'bbox'
311+
ret += f' {bbox_type}:{_list_to_str(self.axes, "")}'
312312
return ret
313313

314314
def __getitem__(self, index: Union[int, str]) -> Axis:
@@ -369,7 +369,7 @@ def __init__(self, fields):
369369

370370
def __str__(self):
371371
fields = _list_to_str(self.fields, '')
372-
ret = f' range type fields:{fields}'
372+
ret = f' range_type:{fields}'
373373
return ret
374374

375375
def __getitem__(self, index: Union[int, str]) -> Field:
@@ -459,7 +459,7 @@ def __str__(self):
459459
if self.definition is not None:
460460
ret += f'{indent}definition: {self.definition}'
461461
if self.nil_values is not None and len(self.nil_values) > 0:
462-
ret += f'{indent}nil values: {_list_to_str(self.nil_values, ",")}'
462+
ret += f'{indent}nil_values: {_list_to_str(self.nil_values, ",")}'
463463
if self.codespace is not None:
464464
ret += f'{indent}codespace: {self.codespace}'
465465
if self.uom is not None:

0 commit comments

Comments
 (0)