Skip to content

Commit c2ed5ee

Browse files
Fix ibtracs collection id and country code.
1 parent 7dd4511 commit c2ed5ee

File tree

16 files changed

+48
-47
lines changed

16 files changed

+48
-47
lines changed

docs/docs/api/sources.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ The sources module provides implementations for different data sources that can
99
- [GDACS](sources/gdacs.md) - Global Disaster Alert and Coordination System integration
1010
- [EMDAT](sources/emdat.md) - Emergency Events Database integration
1111
- [USGS](sources/usgs.md) - United States Geological Survey integration
12-

docs/docs/api/sources/common.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ Example implementation:
2424
class MySourceTransformer(BaseTransformer):
2525
def __init__(self, data: MontyDataSource):
2626
self.data = data
27-
27+
2828
def transform(self, data: Any) -> pystac.Item:
2929
# Validate input data
3030
if not self._validate_data(data):
3131
raise ValueError("Invalid data format")
32-
32+
3333
# Transform data into STAC Item
3434
item = pystac.Item(
3535
id="unique-id",
@@ -38,7 +38,7 @@ class MySourceTransformer(BaseTransformer):
3838
datetime=self._extract_datetime(data),
3939
properties=self._extract_properties(data)
4040
)
41-
41+
4242
# Add any extensions or additional metadata
4343
return item
4444
```

docs/docs/api/sources/emdat.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The `EMDATDataSource` class handles EM-DAT data input in either Excel format or
1515
class EMDATDataSource(MontyDataSource):
1616
"""
1717
EM-DAT data source that can handle both Excel files and pandas DataFrames.
18-
18+
1919
Args:
2020
source_url: URL of the data source
2121
data: Either Excel content as string or pandas DataFrame containing EM-DAT data
@@ -30,7 +30,7 @@ The `EMDATTransformer` class transforms EM-DAT data into STAC Items with the Mon
3030
class EMDATTransformer:
3131
"""
3232
Transforms EM-DAT data into STAC Items with Monty extension.
33-
33+
3434
Args:
3535
data: EMDATDataSource containing the EM-DAT data
3636
geocoder: Optional GAULGeocoder instance for enhanced location handling
@@ -52,11 +52,11 @@ The transformer creates three types of STAC Items:
5252
1. Event Items (`emdat-event-*`)
5353
- Basic event information including location and dates
5454
- Monty extension with hazard codes and country codes
55-
55+
5656
2. Hazard Items (`emdat-hazard-*`)
5757
- Derived from event items
5858
- Additional hazard details including severity and classification
59-
59+
6060
3. Impact Items (`emdat-impact-*`)
6161
- Created for each impact metric
6262
- Includes detailed impact information with type, value, and units

docs/docs/api/sources/gdacs.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ items = transformer.make_items()
3535

3636
# 3. The transformer creates three types of STAC items:
3737
# - Source event item
38-
# - Hazard event item
38+
# - Hazard event item
3939
# - Impact items (from Sendai indicators if present)
4040

4141
# Example: Print details of each item
4242
for item in items:
4343
print(f"\nItem ID: {item.id}")
4444
print(f"Type: {item.properties['roles']}")
45-
45+
4646
# Access Monty extension fields
4747
monty = MontyExtension.ext(item)
4848
if monty.is_source_event():
@@ -111,16 +111,16 @@ class GDACSTransformer:
111111
def __init__(self, data: list[GDACSDataSource]) -> None:
112112
"""
113113
Initialize transformer with GDACS data sources.
114-
114+
115115
Args:
116116
data: List of GDACSDataSource objects containing event and geometry data
117117
"""
118-
118+
119119
def make_items(self) -> list[Item]:
120120
"""
121121
Transform GDACS data into STAC Items.
122122
Creates source event, hazard, and impact items.
123-
123+
124124
Returns:
125125
list[Item]: List of STAC Items with Monty extension
126126
"""

docs/docs/api/sources/glide.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ for item in items:
3737
print(f"Roles: {item.properties['roles']}")
3838
print(f"Datetime: {item.datetime}")
3939
print(f"Location: {item.geometry}")
40-
40+
4141
# Access Monty extension data
4242
monty = MontyExtension.ext(item)
4343
print(f"Hazard codes: {monty.hazard_codes}")
4444
print(f"Country codes: {monty.country_codes}")
45-
45+
4646
if 'hazard' in item.properties['roles']:
4747
print(f"Hazard detail: {monty.hazard_detail}")
4848
```
@@ -149,32 +149,32 @@ For a flood event in Spain (FL-2024-000199-ESP), the transformer creates:
149149
class GlideTransformer:
150150
"""
151151
Transforms GLIDE event data into STAC Items with Monty extension.
152-
152+
153153
The transformer creates two types of items for each GLIDE event:
154154
1. Source event items - Basic event information
155155
2. Hazard event items - Event information with hazard details
156156
"""
157-
157+
158158
def make_items(self) -> list[Item]:
159159
"""
160160
Create both source and hazard items for the GLIDE event.
161-
161+
162162
Returns:
163163
list[Item]: List of STAC Items with Monty extension
164164
"""
165-
165+
166166
def make_source_event_items(self) -> List[Item]:
167167
"""
168168
Create source event items.
169-
169+
170170
Returns:
171171
List[Item]: List of source event STAC Items
172172
"""
173-
173+
174174
def make_hazard_event_items(self) -> List[Item]:
175175
"""
176176
Create hazard event items.
177-
177+
178178
Returns:
179179
List[Item]: List of hazard event STAC Items
180180
"""
@@ -186,7 +186,7 @@ class GlideTransformer:
186186
class GlideDataSource(MontyDataSource):
187187
"""
188188
Wrapper for GLIDE JSON data from glidenumber.net
189-
189+
190190
Args:
191191
source_url: URL of the GLIDE data source
192192
data: JSON response from the GLIDE API

docs/docs/api/sources/usgs.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ items = transformer.make_items()
3131

3232
# 4. The transformer creates three types of STAC items:
3333
# - Source event item
34-
# - Hazard item from ShakeMap
34+
# - Hazard item from ShakeMap
3535
# - Impact items from PAGER data (if losses data provided)
3636

3737
# Example: Print details of each item
3838
for item in items:
3939
print(f"\nItem ID: {item.id}")
4040
print(f"Type: {item.properties['roles']}")
41-
41+
4242
# Access Monty extension fields
4343
monty = MontyExtension.ext(item)
4444
if monty.is_source_event():
@@ -111,16 +111,16 @@ class USGSTransformer:
111111
def __init__(self, data: USGSDataSource) -> None:
112112
"""
113113
Initialize transformer with USGS data source.
114-
114+
115115
Args:
116116
data: USGSDataSource containing event data and optional losses data
117117
"""
118-
118+
119119
def make_items(self) -> list[Item]:
120120
"""
121121
Transform USGS data into STAC Items.
122122
Creates source event, hazard, and impact items if losses data available.
123-
123+
124124
Returns:
125125
list[Item]: List of STAC Items with Monty extension
126126
"""
@@ -153,7 +153,7 @@ Wrapper class for USGS data that handles both event data and optional losses dat
153153
class USGSDataSource(MontyDataSource):
154154
"""
155155
USGS data source that can handle both event detail and losses data.
156-
156+
157157
Args:
158158
source_url: URL where the event data was retrieved from
159159
data: Event detail data as JSON string
@@ -163,11 +163,11 @@ class USGSDataSource(MontyDataSource):
163163
super().__init__(source_url, data)
164164
self.data = json.loads(data)
165165
self.losses_data = json.loads(losses_data) if losses_data else None
166-
166+
167167
def get_data(self) -> dict:
168168
"""Get the event detail data."""
169169
return self.data
170-
170+
171171
def get_losses_data(self) -> Optional[dict]:
172172
"""Get the PAGER losses data if available."""
173173
return self.losses_data
@@ -177,4 +177,4 @@ The data source handles:
177177
- GeoJSON event data from USGS detail API
178178
- Optional PAGER losses data in JSON format
179179
- Automatic JSON parsing and validation
180-
- Access to both event and losses data through clean interface
180+
- Access to both event and losses data through clean interface

pystac_monty/Montandon_Schema_V1-00.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,4 +1327,4 @@
13271327
},
13281328
"minProperties": 1,
13291329
"schema_version": "Monty Schema V1.00"
1330-
}
1330+
}

pystac_monty/sources/gfd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def make_source_event_item(self, data: dict) -> Item:
8888
enddate = pytz.utc.localize(datetime.fromtimestamp(data["system:time_end"] / 1000))
8989

9090
item = Item(
91-
id=f'{STAC_EVENT_ID_PREFIX}{data["id"]}',
91+
id=f"{STAC_EVENT_ID_PREFIX}{data['id']}",
9292
geometry=geometry,
9393
bbox=bbox,
9494
datetime=startdate,

pystac_monty/sources/gidd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def make_source_event_item(self, data: dict) -> Item:
111111
enddate = pytz.utc.localize(datetime.fromisoformat(enddate_str))
112112

113113
item = Item(
114-
id=f'{STAC_EVENT_ID_PREFIX}{properties["ID"]}',
114+
id=f"{STAC_EVENT_ID_PREFIX}{properties['ID']}",
115115
geometry=geometry,
116116
bbox=bbox,
117117
datetime=startdate,
@@ -181,7 +181,7 @@ def make_impact_items(self) -> List[Item]:
181181

182182
impact_item.datetime = startdate
183183
impact_item.properties["title"] = (
184-
f"{properties.get('Figure category')}-{properties.get('Figure unit')} " f"for {properties.get('Event name')}"
184+
f"{properties.get('Figure category')}-{properties.get('Figure unit')} for {properties.get('Event name')}"
185185
)
186186
impact_item.properties.update(
187187
{

pystac_monty/sources/ibtracs.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def make_source_event_items(self) -> List[Item]:
247247
)
248248

249249
# Set collection
250-
item.collection = self.get_event_collection()
250+
item.set_collection(self.get_event_collection())
251251

252252
# Add Monty extension
253253
MontyExtension.add_to(item)
@@ -448,7 +448,7 @@ def make_hazard_items(self, event_items: List[Item]) -> List[Item]:
448448
)
449449

450450
# Set collection
451-
item.collection = self.get_hazard_collection()
451+
item.set_collection(self.get_hazard_collection())
452452

453453
# Add Monty extension
454454
MontyExtension.add_to(item)
@@ -590,13 +590,15 @@ def _get_countries_from_track(self, track_geometry: Union[LineString, Point]) ->
590590
if isinstance(track_geometry, LineString):
591591
for point in track_geometry.coords:
592592
lon, lat = point
593-
country_code = self.geocoder.get_iso3_from_geometry(Point(lon, lat))
593+
# country_code = self.geocoder.get_iso3_from_geometry(Point(lon, lat))
594+
country_code = "UNK"
594595
if country_code:
595596
countries.append(country_code)
596597
# For Point, check the single point
597598
elif isinstance(track_geometry, Point):
598599
lon, lat = track_geometry.x, track_geometry.y
599-
country_code = self.geocoder.get_iso3_from_geometry(track_geometry)
600+
# country_code = self.geocoder.get_iso3_from_geometry(track_geometry)
601+
country_code = "UNK"
600602
if country_code:
601603
countries.append(country_code)
602604
except Exception as e:

0 commit comments

Comments
 (0)