eolas-data 1.3.0__tar.gz → 1.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {eolas_data-1.3.0 → eolas_data-1.5.0}/PKG-INFO +1 -1
- {eolas_data-1.3.0 → eolas_data-1.5.0}/eolas_data/client.py +28 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/pyproject.toml +1 -1
- {eolas_data-1.3.0 → eolas_data-1.5.0}/tests/test_client.py +13 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/.github/workflows/catalog-drift.yml +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/.github/workflows/publish.yml +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/.gitignore +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/README.md +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/eolas_data/__init__.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/eolas_data/_dataset_names.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/eolas_data/_regen_names.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/eolas_data/cli.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/eolas_data/dataset.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/eolas_data/exceptions.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/eolas_data/schedule.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/tests/test_cli.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.5.0}/tests/test_schedule.py +0 -0
|
@@ -203,6 +203,29 @@ class Client:
|
|
|
203
203
|
"""Fetch a WorkSafe NZ dataset."""
|
|
204
204
|
return self._get_source(name, "WorkSafe NZ", **kwargs)
|
|
205
205
|
|
|
206
|
+
def immigration(self, name, **kwargs) -> Dataset:
|
|
207
|
+
"""Fetch an Immigration NZ dataset."""
|
|
208
|
+
return self._get_source(name, "Immigration NZ", **kwargs)
|
|
209
|
+
|
|
210
|
+
def lris(self, name, **kwargs) -> Dataset:
|
|
211
|
+
"""Fetch a Manaaki Whenua LRIS dataset (land cover, soil, protected areas).
|
|
212
|
+
|
|
213
|
+
Examples::
|
|
214
|
+
|
|
215
|
+
client.lris("lcdb_v6_mainland") # current NZ land cover (~543k polygons)
|
|
216
|
+
client.lris("nzlum_v03") # NZ Land Use Management v0.3
|
|
217
|
+
client.lris("pan_nz_2025_draft") # protected areas (Draft, 2025)
|
|
218
|
+
|
|
219
|
+
Notes:
|
|
220
|
+
LCDB v3.0–v4.1 are deprecated vintages, retained for longitudinal
|
|
221
|
+
analysis. LCDB v5 is superseded by v6 but still served.
|
|
222
|
+
PAN-NZ 2025 was marked Draft at the time of ingestion (2026-05-12).
|
|
223
|
+
Source: https://lris.scinfo.org.nz
|
|
224
|
+
Licence: CC-BY 4.0 International (LCDB v5/v6, NZLUM, PBC, PAN-NZ);
|
|
225
|
+
CC-BY 3.0 NZ (LCDB v3/v4 vintages). Attribution: Manaaki Whenua.
|
|
226
|
+
"""
|
|
227
|
+
return self._get_source(name, "Manaaki Whenua / LRIS", **kwargs)
|
|
228
|
+
|
|
206
229
|
def _get_source(self, name, source: str, **kwargs) -> Dataset:
|
|
207
230
|
df = self.get(name, **kwargs)
|
|
208
231
|
df.eolas_source = source
|
|
@@ -271,6 +294,11 @@ class Client:
|
|
|
271
294
|
if "date" in df.columns:
|
|
272
295
|
df["date"] = pd.to_datetime(df["date"])
|
|
273
296
|
|
|
297
|
+
# API streams from Iceberg in file order, not chronological — sort here so
|
|
298
|
+
# callers can `df.plot(x="date", y="value")` without seeing zigzag lines.
|
|
299
|
+
if "date" in df.columns:
|
|
300
|
+
df = df.sort_values("date", kind="stable").reset_index(drop=True)
|
|
301
|
+
|
|
274
302
|
result = Dataset(df)
|
|
275
303
|
result.eolas_name = name
|
|
276
304
|
result.eolas_source = ""
|
|
@@ -101,6 +101,19 @@ def test_get_returns_dataset(client):
|
|
|
101
101
|
assert df.eolas_name == "nz_cpi"
|
|
102
102
|
|
|
103
103
|
|
|
104
|
+
@resp_lib.activate
|
|
105
|
+
def test_get_sorts_rows_by_date(client):
|
|
106
|
+
# API streams Iceberg in file order, not chronological — client must sort.
|
|
107
|
+
unsorted = [
|
|
108
|
+
{"date": "2023-04-01", "period": "2023Q2", "value": 101.5},
|
|
109
|
+
{"date": "2022-01-01", "period": "2022Q1", "value": 99.0},
|
|
110
|
+
{"date": "2023-01-01", "period": "2023Q1", "value": 100.0},
|
|
111
|
+
]
|
|
112
|
+
resp_lib.add(resp_lib.GET, f"{BASE}/v1/datasets/nz_cpi/data", json={"data": unsorted})
|
|
113
|
+
df = client.get("nz_cpi")
|
|
114
|
+
assert list(df["date"].dt.strftime("%Y-%m-%d")) == ["2022-01-01", "2023-01-01", "2023-04-01"]
|
|
115
|
+
|
|
116
|
+
|
|
104
117
|
@resp_lib.activate
|
|
105
118
|
def test_get_passes_date_params(client):
|
|
106
119
|
resp_lib.add(resp_lib.GET, f"{BASE}/v1/datasets/nz_cpi/data", json={"data": RECORDS})
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|