|
1 | 1 | import pandas as pd
|
2 | 2 |
|
3 |
| -from ..convert_utils import convert as convert_ |
4 |
| -from .commons.ec import add_eurocrops |
| 3 | +from ..convert_utils import BaseConverter |
| 4 | +from .commons.ec import EuroCropsConverterMixin |
5 | 5 |
|
6 | 6 | # todo: The dataset doesn't validate due to a self intersecting polygon
|
7 | 7 | # How do we want to handle this?
|
8 | 8 |
|
9 |
| -SOURCES = "https://zenodo.org/records/8229128/files/EE_2021.zip?download=1" |
10 | 9 |
|
11 |
| -ID = "ec_ee" |
12 |
| -SHORT_NAME = "Estonia" |
13 |
| -TITLE = "Field boundaries for Estonia" |
14 |
| -DESCRIPTION = """ |
15 |
| -Geospatial Aid Application Estonia Agricultural parcels. |
16 |
| -The original dataset is provided by ARIB and obtained from the INSPIRE theme GSAA (specifically Geospaial Aid Application Estonia Agricultural parcels) through which the data layer Fields and Eco Areas (GSAA) is made available. |
17 |
| -The data comes from ARIB's database of agricultural parcels. |
18 |
| -""" |
19 |
| -PROVIDERS = [ |
20 |
| - { |
21 |
| - "name": "Põllumajanduse Registrite ja Informatsiooni Amet", |
22 |
| - "url": "http://data.europa.eu/88u/dataset/pria-pollud", |
23 |
| - "roles": ["producer", "licensor"], |
| 10 | +class Convert(EuroCropsConverterMixin, BaseConverter): |
| 11 | + ec_mapping_csv = "ee_2021.csv" |
| 12 | + sources = "https://zenodo.org/records/8229128/files/EE_2021.zip?download=1" |
| 13 | + id = "ec_ee" |
| 14 | + short_name = "Estonia" |
| 15 | + title = "Field boundaries for Estonia" |
| 16 | + description = """ |
| 17 | + Geospatial Aid Application Estonia Agricultural parcels. |
| 18 | + The original dataset is provided by ARIB and obtained from the INSPIRE theme GSAA (specifically Geospaial Aid Application Estonia Agricultural parcels) through which the data layer Fields and Eco Areas (GSAA) is made available. |
| 19 | + The data comes from ARIB's database of agricultural parcels. |
| 20 | + """ |
| 21 | + providers = [ |
| 22 | + { |
| 23 | + "name": "Põllumajanduse Registrite ja Informatsiooni Amet", |
| 24 | + "url": "http://data.europa.eu/88u/dataset/pria-pollud", |
| 25 | + "roles": ["producer", "licensor"], |
| 26 | + } |
| 27 | + ] |
| 28 | + attribution = "© Põllumajanduse Registrite ja Informatsiooni Amet" |
| 29 | + |
| 30 | + columns = { |
| 31 | + "geometry": "geometry", |
| 32 | + "pollu_id": "id", |
| 33 | + "taotlusaas": "determination_datetime", # year |
| 34 | + "pindala_ha": "area", # area (in ha) |
| 35 | + "taotletud_": "crop:code", # requested crop culture |
| 36 | + "taotletu_1": "taotletud_maakasutus", # requested land use |
| 37 | + "taotletu_2": "taotletud_toetus", # requested support |
| 38 | + "niitmise_t": "niitmise_tuvastamise_staatus", # mowing detection status |
| 39 | + "niitmise_1": "niitmise_tuvast_ajavahemik", # mowing detection period |
| 40 | + "viimase_mu": "viimase_muutmise_aeg", # Last edit time (date-date) |
| 41 | + "taotleja_n": "taotleja_nimi", # name of applicant |
| 42 | + "taotleja_r": "taotleja_registrikood", # applicant's registration code |
| 43 | + } |
| 44 | + column_migrations = {"JAHR": lambda col: pd.to_datetime(col, format="%Y")} |
| 45 | + missing_schemas = { |
| 46 | + "required": [ |
| 47 | + "taotletud_kultuur", |
| 48 | + "taotletud_maakasutus", |
| 49 | + "viimase_muutmise_aeg", |
| 50 | + "taotleja_nimi", |
| 51 | + ], |
| 52 | + "properties": { |
| 53 | + "taotletud_kultuur": {"type": "string"}, |
| 54 | + "taotletud_maakasutus": {"type": "string"}, |
| 55 | + "niitmise_tuvastamise_staatus": {"type": "string"}, |
| 56 | + "niitmise_tuvast_ajavahemik": {"type": "string"}, |
| 57 | + "viimase_muutmise_aeg": {"type": "string"}, |
| 58 | + "taotletud_toetus": {"type": "string"}, |
| 59 | + "taotleja_nimi": {"type": "string"}, |
| 60 | + "taotleja_registrikood": {"type": "string"}, |
| 61 | + }, |
24 | 62 | }
|
25 |
| -] |
26 |
| -ATTRIBUTION = "© Põllumajanduse Registrite ja Informatsiooni Amet" |
27 |
| - |
28 |
| -COLUMNS = { |
29 |
| - "geometry": "geometry", |
30 |
| - "pollu_id": "id", |
31 |
| - "taotlusaas": "determination_datetime", # year |
32 |
| - "pindala_ha": "area", # area (in ha) |
33 |
| - "taotletud_": "taotletud_kultuur", # requested crop culture |
34 |
| - "taotletu_1": "taotletud_maakasutus", # requested land use |
35 |
| - "taotletu_2": "taotletud_toetus", # requested support |
36 |
| - "niitmise_t": "niitmise_tuvastamise_staatus", # mowing detection status |
37 |
| - "niitmise_1": "niitmise_tuvast_ajavahemik", # mowing detection period |
38 |
| - "viimase_mu": "viimase_muutmise_aeg", # Last edit time (date-date) |
39 |
| - "taotleja_n": "taotleja_nimi", # name of applicant |
40 |
| - "taotleja_r": "taotleja_registrikood", # applicant's registration code |
41 |
| -} |
42 |
| -COLUMN_MIGRATIONS = {"JAHR": lambda col: pd.to_datetime(col, format="%Y")} |
43 |
| -MISSING_SCHEMAS = { |
44 |
| - "required": [ |
45 |
| - "taotletud_kultuur", |
46 |
| - "taotletud_maakasutus", |
47 |
| - "viimase_muutmise_aeg", |
48 |
| - "taotleja_nimi", |
49 |
| - ], |
50 |
| - "properties": { |
51 |
| - "taotletud_kultuur": {"type": "string"}, |
52 |
| - "taotletud_maakasutus": {"type": "string"}, |
53 |
| - "niitmise_tuvastamise_staatus": {"type": "string"}, |
54 |
| - "niitmise_tuvast_ajavahemik": {"type": "string"}, |
55 |
| - "viimase_muutmise_aeg": {"type": "string"}, |
56 |
| - "taotletud_toetus": {"type": "string"}, |
57 |
| - "taotleja_nimi": {"type": "string"}, |
58 |
| - "taotleja_registrikood": {"type": "string"}, |
59 |
| - }, |
60 |
| -} |
61 |
| - |
62 |
| -ID, SHORT_NAME, TITLE, DESCRIPTION, PROVIDERS, EXTENSIONS, COLUMNS, LICENSE = add_eurocrops( |
63 |
| - vars(), 2021 |
64 |
| -) |
65 |
| - |
66 |
| - |
67 |
| -def convert(output_file, cache=None, **kwargs): |
68 |
| - convert_( |
69 |
| - output_file, |
70 |
| - cache, |
71 |
| - SOURCES, |
72 |
| - COLUMNS, |
73 |
| - ID, |
74 |
| - TITLE, |
75 |
| - DESCRIPTION, |
76 |
| - providers=PROVIDERS, |
77 |
| - extensions=EXTENSIONS, |
78 |
| - column_migrations=COLUMN_MIGRATIONS, |
79 |
| - missing_schemas=MISSING_SCHEMAS, |
80 |
| - attribution=ATTRIBUTION, |
81 |
| - license=LICENSE, |
82 |
| - **kwargs, |
83 |
| - ) |
0 commit comments