Skip to content

PT: the 2025 edition, and the right id - #243

Open
ivorbosloper wants to merge 1 commit into
mainfrom
split/pt
Open

PT: the 2025 edition, and the right id#243
ivorbosloper wants to merge 1 commit into
mainfrom
split/pt

Conversation

@ivorbosloper

@ivorbosloper ivorbosloper commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

IFAP restructured the download for 2025 and almost nothing matches 2023:

up to 2023 2025
layers Culturas_<district> T<NUTS3>
crop code CUL_CODIGO PUN_CUL_CO
CRS / area metres WGS 84, area in square degrees

The area is recomputed on EPSG:6933 for 2025. The identifier was also the wrong way round: OSA_ID is the land-occupation polygon, CUL_ID the crop parcel, unique across every layer of both editions.

Adds the "<id>#<label>" form to the test list so one converter can be tested on two editions; dk (#258) uses it too.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DVx9uQV2QPM8ecPAY3ZjXG

ivorbosloper added a commit that referenced this pull request Sep 12, 2026
The archives before 2023 are a different release. GPZ_DP calls the crop name
PLODINA_NA and the declared area DEKL_VYMER, carries no application date, and
identifies nothing per row: ENTITA_ID is the land block and repeats once per
crop declared on it — 242,754 distinct over the 282,462 rows of 2019. Rename
the columns, keep ENTITA_ID as block_id, count the fields positionally for
the id, and date the edition by its campaign year.

The 2020 release then fills PLODINA_ID in 5,804 of its 297,680 rows and names
the crop in all of them, in the ministry's own vocabulary — it writes
"Pšenice ozimá" where EuroCrops writes "Pšenice setá ozimá", so cz_2023.csv
matches only a third of the names. The codes come from a name table built out
of the 2019, 2021 and 2022 editions: 268 names, none carrying two codes,
agreeing with the 5,804 rows of 2020 that do have one, and covering all but
0.004% of them.

cz_2023.csv maps the code list of the 2023 release. The older editions
declare 120 codes outside it (11.4% of their rows: fallow, ware potatoes,
spelt, poppy, ryegrass, the alfalfa and clover mixes) and the newer ones 47
more (0.64%: the hemp varieties the ministry lists one by one, grasses,
vegetable-and-herb mixes, and the strips and landscape features that are no
crop at all). 68 of them are the same crop the current editions still declare
under another code, so they take the HCAT that code already has; the rest are
mapped against hcat3.csv. Without the table the backfilled editions carry no
HCAT for a ninth of their fields; with it, none of the eight editions leaves
a single crop unmapped.

Last, the 2026 edition lists one declaration twice, once per land block it
straddles, with the whole declaration's geometry both times. Keep the first
of each such repeat; a repeat whose shape differs is not this case and still
fails the identity check.

The test harness gains the "<id>#<label>" form, as in #243, to run
the second and third editions from the same folder of input files.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DVx9uQV2QPM8ecPAY3ZjXG
ivorbosloper added a commit that referenced this pull request Sep 12, 2026
The archives before 2023 are a different release. GPZ_DP calls the crop name
PLODINA_NA and the declared area DEKL_VYMER, carries no application date, and
identifies nothing per row: ENTITA_ID is the land block and repeats once per
crop declared on it — 242,754 distinct over the 282,462 rows of 2019. Rename
the columns, keep ENTITA_ID as block_id, count the fields positionally for
the id, and date the edition by its campaign year.

The 2020 release then fills PLODINA_ID in 5,804 of its 297,680 rows and names
the crop in all of them, in the ministry's own vocabulary — it writes
"Pšenice ozimá" where EuroCrops writes "Pšenice setá ozimá", so cz_2023.csv
matches only a third of the names. The codes come from a name table built out
of the 2019, 2021 and 2022 editions: 268 names, none carrying two codes,
agreeing with the 5,804 rows of 2020 that do have one, and covering all but
0.004% of them.

cz_2023.csv maps the code list of the 2023 release. The older editions
declare 120 codes outside it (11.4% of their rows: fallow, ware potatoes,
spelt, poppy, ryegrass, the alfalfa and clover mixes) and the newer ones 47
more (0.64%: the hemp varieties the ministry lists one by one, grasses,
vegetable-and-herb mixes, and the strips and landscape features that are no
crop at all). 68 of them are the same crop the current editions still declare
under another code, so they take the HCAT that code already has; the rest are
mapped against hcat3.csv. Without the table the backfilled editions carry no
HCAT for a ninth of their fields; with it, none of the eight editions leaves
a single crop unmapped.

Last, the 2026 edition lists one declaration twice, once per land block it
straddles, with the whole declaration's geometry both times. Keep the first
of each such repeat; a repeat whose shape differs is not this case and still
fails the identity check.

The test harness gains the "<id>#<label>" form, as in #243, to run
the second and third editions from the same folder of input files.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DVx9uQV2QPM8ecPAY3ZjXG
IFAP restructured the download for 2025: the country arrives as T<NUTS3> layers
instead of Culturas_<district>, the crop code is PUN_CUL_CO instead of
CUL_CODIGO, there is no crop name, and the file is WGS 84 with Shape_Area and
Shape_Length in degrees, so the area is recomputed on EPSG:6933.

The identifier was also the wrong way round: OSA_ID is the land occupation
polygon, while CUL_ID identifies the crop parcel and is unique across every
layer of both editions.

Testing one converter on two editions needs a way to name them, so an entry in
the test list may be "<id>#<label>": pt stays pinned to 2023 and pt#2025 covers
the new shape, both reading the same folder of input files.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DVx9uQV2QPM8ecPAY3ZjXG
@ivorbosloper ivorbosloper changed the title PT: the 2025 edition, and the id the two editions disagreed on PT: the 2025 edition, and the right id Sep 12, 2026
ivorbosloper added a commit that referenced this pull request Sep 12, 2026
The archives before 2023 are a different release. GPZ_DP calls the crop name
PLODINA_NA and the declared area DEKL_VYMER, carries no application date, and
identifies nothing per row: ENTITA_ID is the land block and repeats once per
crop declared on it — 242,754 distinct over the 282,462 rows of 2019. Rename
the columns, keep ENTITA_ID as block_id, count the fields positionally for
the id, and date the edition by its campaign year.

The 2020 release then fills PLODINA_ID in 5,804 of its 297,680 rows and names
the crop in all of them, in the ministry's own vocabulary — it writes
"Pšenice ozimá" where EuroCrops writes "Pšenice setá ozimá", so cz_2023.csv
matches only a third of the names. The codes come from a name table built out
of the 2019, 2021 and 2022 editions: 268 names, none carrying two codes,
agreeing with the 5,804 rows of 2020 that do have one, and covering all but
0.004% of them.

cz_2023.csv maps the code list of the 2023 release. The older editions
declare 120 codes outside it (11.4% of their rows: fallow, ware potatoes,
spelt, poppy, ryegrass, the alfalfa and clover mixes) and the newer ones 47
more (0.64%: the hemp varieties the ministry lists one by one, grasses,
vegetable-and-herb mixes, and the strips and landscape features that are no
crop at all). 68 of them are the same crop the current editions still declare
under another code, so they take the HCAT that code already has; the rest are
mapped against hcat3.csv. Without the table the backfilled editions carry no
HCAT for a ninth of their fields; with it, none of the eight editions leaves
a single crop unmapped.

Last, the 2026 edition lists one declaration twice, once per land block it
straddles, with the whole declaration's geometry both times. Keep the first
of each such repeat; a repeat whose shape differs is not this case and still
fails the identity check.

The test harness gains the "<id>#<label>" form, as in #243, to run
the second and third editions from the same folder of input files.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DVx9uQV2QPM8ecPAY3ZjXG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant