tunned-geobr 0.2.10__py3-none-any.whl → 1.0.0__py3-none-any.whl
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.
- tunned_geobr/__init__.py +3 -0
- tunned_geobr/list_geobr.py +6 -1
- tunned_geobr/read_amazon.py +1 -1
- tunned_geobr/read_ibama_embargoes.py +85 -0
- tunned_geobr/read_icmbio_embargoes.py +83 -0
- tunned_geobr/read_icmbio_infractions.py +83 -0
- {tunned_geobr-0.2.10.dist-info → tunned_geobr-1.0.0.dist-info}/METADATA +1 -1
- {tunned_geobr-0.2.10.dist-info → tunned_geobr-1.0.0.dist-info}/RECORD +11 -8
- {tunned_geobr-0.2.10.dist-info → tunned_geobr-1.0.0.dist-info}/WHEEL +0 -0
- {tunned_geobr-0.2.10.dist-info → tunned_geobr-1.0.0.dist-info}/entry_points.txt +0 -0
- {tunned_geobr-0.2.10.dist-info → tunned_geobr-1.0.0.dist-info}/licenses/LICENSE.txt +0 -0
tunned_geobr/__init__.py
CHANGED
@@ -125,3 +125,6 @@ from .read_natural_gas_processing_hub import read_natural_gas_processing_hub
|
|
125
125
|
from .read_compression_stations import read_compression_stations
|
126
126
|
from .read_natural_gas_delivery_points import read_natural_gas_delivery_points
|
127
127
|
from .read_quilombola_areas import read_quilombola_areas
|
128
|
+
from .read_icmbio_embargoes import read_icmbio_embargoes
|
129
|
+
from .read_icmbio_infractions import read_icmbio_infractions
|
130
|
+
from .read_ibama_embargoes import read_ibama_embargoes
|
tunned_geobr/list_geobr.py
CHANGED
@@ -168,7 +168,12 @@ def list_geobr():
|
|
168
168
|
{"Function": "read_og_basement", "Geography": "Oil and Gas Basement", "Years": "All", "Source": "EPE"},
|
169
169
|
{"Function": "read_hydroelectric_feasibility_studies", "Geography": "Hydroelectric Feasibility Studies", "Years": "All", "Source": "EPE"},
|
170
170
|
{"Function": "read_hydroelectric_inventory_aai_studies", "Geography": "Hydroelectric Inventory and AAI Studies", "Years": "All", "Source": "EPE"},
|
171
|
-
{"Function": "read_ama_anemometric_towers", "Geography": "AMA Anemometric Towers", "Years": "All", "Source": "EPE"}
|
171
|
+
{"Function": "read_ama_anemometric_towers", "Geography": "AMA Anemometric Towers", "Years": "All", "Source": "EPE"},
|
172
|
+
|
173
|
+
# Environmental Enforcement Data
|
174
|
+
{"Function": "read_icmbio_embargoes", "Geography": "ICMBio Embargoed Areas", "Years": "All", "Source": "ICMBio"},
|
175
|
+
{"Function": "read_icmbio_infractions", "Geography": "ICMBio Infraction Notices", "Years": "All", "Source": "ICMBio"},
|
176
|
+
{"Function": "read_ibama_embargoes", "Geography": "IBAMA Embargoed Areas", "Years": "All", "Source": "IBAMA"}
|
172
177
|
]
|
173
178
|
|
174
179
|
# Create DataFrame
|
tunned_geobr/read_amazon.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
from geobr.utils import select_metadata, download_gpkg
|
2
2
|
|
3
3
|
|
4
|
-
def read_amazon(year=2012, simplified=
|
4
|
+
def read_amazon(year=2012, simplified=False, verbose=False):
|
5
5
|
""" Download official data of Brazil's Legal Amazon as an sf object.
|
6
6
|
|
7
7
|
This data set covers the whole of Brazil's Legal Amazon as defined in the federal law n. 12.651/2012). The original
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import geopandas as gpd
|
2
|
+
import requests
|
3
|
+
from io import BytesIO
|
4
|
+
|
5
|
+
def read_ibama_embargoes(simplified=False, verbose=False):
|
6
|
+
"""Download IBAMA Embargoes data.
|
7
|
+
|
8
|
+
This function downloads and processes embargoes data from the Brazilian Institute
|
9
|
+
of Environment and Renewable Natural Resources (IBAMA) through their WFS service.
|
10
|
+
Original source: IBAMA SISCOM
|
11
|
+
|
12
|
+
Parameters
|
13
|
+
----------
|
14
|
+
simplified : boolean, by default False
|
15
|
+
If True, returns a simplified version of the dataset with fewer columns
|
16
|
+
verbose : boolean, by default False
|
17
|
+
If True, prints detailed information about the download process
|
18
|
+
|
19
|
+
Returns
|
20
|
+
-------
|
21
|
+
gpd.GeoDataFrame
|
22
|
+
Geodataframe with IBAMA Embargoes data
|
23
|
+
|
24
|
+
Example
|
25
|
+
-------
|
26
|
+
>>> from tunned_geobr import read_ibama_embargoes
|
27
|
+
|
28
|
+
# Read IBAMA Embargoes data
|
29
|
+
>>> embargoes = read_ibama_embargoes()
|
30
|
+
"""
|
31
|
+
|
32
|
+
url = "https://siscom.ibama.gov.br/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=publica:vw_brasil_adm_embargo_a&outputFormat=application/json"
|
33
|
+
|
34
|
+
if verbose:
|
35
|
+
print("Downloading IBAMA Embargoes data...")
|
36
|
+
|
37
|
+
try:
|
38
|
+
# Download the JSON data
|
39
|
+
response = requests.get(url)
|
40
|
+
if response.status_code != 200:
|
41
|
+
raise Exception(f"Failed to download data from IBAMA WFS service. Status code: {response.status_code}")
|
42
|
+
|
43
|
+
if verbose:
|
44
|
+
print("Data downloaded successfully. Processing...")
|
45
|
+
|
46
|
+
# Read the GeoJSON directly from the response content
|
47
|
+
gdf = gpd.read_file(BytesIO(response.content))
|
48
|
+
|
49
|
+
# Convert to SIRGAS 2000 (EPSG:4674) if needed
|
50
|
+
if gdf.crs is None or gdf.crs.to_epsg() != 4674:
|
51
|
+
if verbose:
|
52
|
+
print(f"Converting CRS from {gdf.crs} to SIRGAS 2000 (EPSG:4674)")
|
53
|
+
gdf = gdf.to_crs(4674)
|
54
|
+
|
55
|
+
if simplified:
|
56
|
+
# Keep only the most relevant columns
|
57
|
+
# Adjust these based on the actual columns in the dataset
|
58
|
+
columns_to_keep = [
|
59
|
+
'geometry',
|
60
|
+
'nm_municipio', # Municipality name
|
61
|
+
'sg_uf', # State abbreviation
|
62
|
+
'nm_pessoa', # Person/entity name
|
63
|
+
'nr_cpfcnpj', # CPF/CNPJ number
|
64
|
+
'dt_embargo', # Embargo date
|
65
|
+
'nr_processo', # Process number
|
66
|
+
'nr_termo', # Term number
|
67
|
+
'ar_embargada', # Embargoed area
|
68
|
+
'tp_infracao', # Infraction type
|
69
|
+
'ds_infracao' # Infraction description
|
70
|
+
]
|
71
|
+
|
72
|
+
# Filter columns that actually exist in the dataset
|
73
|
+
existing_columns = ['geometry'] + [col for col in columns_to_keep[1:] if col in gdf.columns]
|
74
|
+
gdf = gdf[existing_columns]
|
75
|
+
|
76
|
+
if verbose:
|
77
|
+
print(f"Simplified dataset with {len(existing_columns)} columns")
|
78
|
+
|
79
|
+
except Exception as e:
|
80
|
+
raise Exception(f"Error downloading IBAMA Embargoes data: {str(e)}")
|
81
|
+
|
82
|
+
if verbose:
|
83
|
+
print(f"Download completed. Returning GeoDataFrame with {len(gdf)} records")
|
84
|
+
|
85
|
+
return gdf
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import geopandas as gpd
|
2
|
+
import requests
|
3
|
+
from io import BytesIO
|
4
|
+
|
5
|
+
def read_icmbio_embargoes(simplified=False, verbose=False):
|
6
|
+
"""Download ICMBio Embargoes data.
|
7
|
+
|
8
|
+
This function downloads and processes embargoes data from the Brazilian Institute
|
9
|
+
of Environment and Renewable Natural Resources (ICMBio) through the National Spatial
|
10
|
+
Data Infrastructure (INDE) WFS service.
|
11
|
+
Original source: ICMBio via INDE
|
12
|
+
|
13
|
+
Parameters
|
14
|
+
----------
|
15
|
+
simplified : boolean, by default False
|
16
|
+
If True, returns a simplified version of the dataset with fewer columns
|
17
|
+
verbose : boolean, by default False
|
18
|
+
If True, prints detailed information about the download process
|
19
|
+
|
20
|
+
Returns
|
21
|
+
-------
|
22
|
+
gpd.GeoDataFrame
|
23
|
+
Geodataframe with ICMBio Embargoes data
|
24
|
+
|
25
|
+
Example
|
26
|
+
-------
|
27
|
+
>>> from tunned_geobr import read_icmbio_embargoes
|
28
|
+
|
29
|
+
# Read ICMBio Embargoes data
|
30
|
+
>>> embargoes = read_icmbio_embargoes()
|
31
|
+
"""
|
32
|
+
|
33
|
+
url = "https://geoservicos.inde.gov.br/geoserver/ICMBio/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=embargos_icmbio&outputFormat=application/json"
|
34
|
+
|
35
|
+
if verbose:
|
36
|
+
print("Downloading ICMBio Embargoes data...")
|
37
|
+
|
38
|
+
try:
|
39
|
+
# Download the JSON data
|
40
|
+
response = requests.get(url)
|
41
|
+
if response.status_code != 200:
|
42
|
+
raise Exception(f"Failed to download data from ICMBio WFS service. Status code: {response.status_code}")
|
43
|
+
|
44
|
+
if verbose:
|
45
|
+
print("Data downloaded successfully. Processing...")
|
46
|
+
|
47
|
+
# Read the GeoJSON directly from the response content
|
48
|
+
gdf = gpd.read_file(BytesIO(response.content))
|
49
|
+
|
50
|
+
# Convert to SIRGAS 2000 (EPSG:4674) if needed
|
51
|
+
if gdf.crs is None or gdf.crs.to_epsg() != 4674:
|
52
|
+
if verbose:
|
53
|
+
print(f"Converting CRS from {gdf.crs} to SIRGAS 2000 (EPSG:4674)")
|
54
|
+
gdf = gdf.to_crs(4674)
|
55
|
+
|
56
|
+
if simplified:
|
57
|
+
# Keep only the most relevant columns
|
58
|
+
# Adjust these based on the actual columns in the dataset
|
59
|
+
columns_to_keep = [
|
60
|
+
'geometry',
|
61
|
+
'NOME_AREA', # Area name
|
62
|
+
'MUNICIPIO', # Municipality
|
63
|
+
'UF', # State
|
64
|
+
'AREA_HA', # Area in hectares
|
65
|
+
'TIPO_INFRA', # Infraction type
|
66
|
+
'DATA_EMBARG', # Embargo date
|
67
|
+
'TERMO_EMBG' # Embargo term
|
68
|
+
]
|
69
|
+
|
70
|
+
# Filter columns that actually exist in the dataset
|
71
|
+
existing_columns = ['geometry'] + [col for col in columns_to_keep[1:] if col in gdf.columns]
|
72
|
+
gdf = gdf[existing_columns]
|
73
|
+
|
74
|
+
if verbose:
|
75
|
+
print(f"Simplified dataset with {len(existing_columns)} columns")
|
76
|
+
|
77
|
+
except Exception as e:
|
78
|
+
raise Exception(f"Error downloading ICMBio Embargoes data: {str(e)}")
|
79
|
+
|
80
|
+
if verbose:
|
81
|
+
print(f"Download completed. Returning GeoDataFrame with {len(gdf)} records")
|
82
|
+
|
83
|
+
return gdf
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import geopandas as gpd
|
2
|
+
import requests
|
3
|
+
from io import BytesIO
|
4
|
+
|
5
|
+
def read_icmbio_infractions(simplified=False, verbose=False):
|
6
|
+
"""Download ICMBio Infraction Notices data.
|
7
|
+
|
8
|
+
This function downloads and processes infraction notices data from the Brazilian Institute
|
9
|
+
of Environment and Renewable Natural Resources (ICMBio) through the National Spatial
|
10
|
+
Data Infrastructure (INDE) WFS service.
|
11
|
+
Original source: ICMBio via INDE
|
12
|
+
|
13
|
+
Parameters
|
14
|
+
----------
|
15
|
+
simplified : boolean, by default False
|
16
|
+
If True, returns a simplified version of the dataset with fewer columns
|
17
|
+
verbose : boolean, by default False
|
18
|
+
If True, prints detailed information about the download process
|
19
|
+
|
20
|
+
Returns
|
21
|
+
-------
|
22
|
+
gpd.GeoDataFrame
|
23
|
+
Geodataframe with ICMBio Infraction Notices data
|
24
|
+
|
25
|
+
Example
|
26
|
+
-------
|
27
|
+
>>> from tunned_geobr import read_icmbio_infractions
|
28
|
+
|
29
|
+
# Read ICMBio Infraction Notices data
|
30
|
+
>>> infractions = read_icmbio_infractions()
|
31
|
+
"""
|
32
|
+
|
33
|
+
url = "https://geoservicos.inde.gov.br/geoserver/ICMBio/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=autos_infracao_icmbio&outputFormat=application/json"
|
34
|
+
|
35
|
+
if verbose:
|
36
|
+
print("Downloading ICMBio Infraction Notices data...")
|
37
|
+
|
38
|
+
try:
|
39
|
+
# Download the JSON data
|
40
|
+
response = requests.get(url)
|
41
|
+
if response.status_code != 200:
|
42
|
+
raise Exception(f"Failed to download data from ICMBio WFS service. Status code: {response.status_code}")
|
43
|
+
|
44
|
+
if verbose:
|
45
|
+
print("Data downloaded successfully. Processing...")
|
46
|
+
|
47
|
+
# Read the GeoJSON directly from the response content
|
48
|
+
gdf = gpd.read_file(BytesIO(response.content))
|
49
|
+
|
50
|
+
# Convert to SIRGAS 2000 (EPSG:4674) if needed
|
51
|
+
if gdf.crs is None or gdf.crs.to_epsg() != 4674:
|
52
|
+
if verbose:
|
53
|
+
print(f"Converting CRS from {gdf.crs} to SIRGAS 2000 (EPSG:4674)")
|
54
|
+
gdf = gdf.to_crs(4674)
|
55
|
+
|
56
|
+
if simplified:
|
57
|
+
# Keep only the most relevant columns
|
58
|
+
# Adjust these based on the actual columns in the dataset
|
59
|
+
columns_to_keep = [
|
60
|
+
'geometry',
|
61
|
+
'MUNICIPIO', # Municipality
|
62
|
+
'UF', # State
|
63
|
+
'DATA_AUTO', # Infraction date
|
64
|
+
'TIPO_INFRA', # Infraction type
|
65
|
+
'AREA_PROTE', # Protected area
|
66
|
+
'VALOR_AUTO', # Fine value
|
67
|
+
'NUM_AUTO' # Infraction number
|
68
|
+
]
|
69
|
+
|
70
|
+
# Filter columns that actually exist in the dataset
|
71
|
+
existing_columns = ['geometry'] + [col for col in columns_to_keep[1:] if col in gdf.columns]
|
72
|
+
gdf = gdf[existing_columns]
|
73
|
+
|
74
|
+
if verbose:
|
75
|
+
print(f"Simplified dataset with {len(existing_columns)} columns")
|
76
|
+
|
77
|
+
except Exception as e:
|
78
|
+
raise Exception(f"Error downloading ICMBio Infraction Notices data: {str(e)}")
|
79
|
+
|
80
|
+
if verbose:
|
81
|
+
print(f"Download completed. Returning GeoDataFrame with {len(gdf)} records")
|
82
|
+
|
83
|
+
return gdf
|
@@ -1,13 +1,13 @@
|
|
1
|
-
tunned_geobr-0.
|
2
|
-
tunned_geobr-0.
|
3
|
-
tunned_geobr-0.
|
4
|
-
tunned_geobr-0.
|
5
|
-
tunned_geobr/__init__.py,sha256=
|
1
|
+
tunned_geobr-1.0.0.dist-info/METADATA,sha256=4vI9Jp2a5SZS9G4UG-9bOrPPwbxrUx-OLvueEql-c9s,5018
|
2
|
+
tunned_geobr-1.0.0.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
+
tunned_geobr-1.0.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
+
tunned_geobr-1.0.0.dist-info/licenses/LICENSE.txt,sha256=mECZRcbde3HssOKe1Co4zgqBLGVN0OWpTsEy3LIbcRA,75
|
5
|
+
tunned_geobr/__init__.py,sha256=RP_fInq17ZOJxZOIVtkWeYDBUIr2lR4QbbHbvMqr5K4,7454
|
6
6
|
tunned_geobr/data/grid_state_correspondence_table.csv,sha256=FpkBuX_-lRXQ1yBrQODxQgG9oha9Fd8A8zGKfdsDAmk,2660
|
7
|
-
tunned_geobr/list_geobr.py,sha256=
|
7
|
+
tunned_geobr/list_geobr.py,sha256=6rsdtSZUvFrS-n5KXLOSQ34P1AK_yMFAj_MVZRvvZmQ,17278
|
8
8
|
tunned_geobr/lookup_muni.py,sha256=ny1zU4i6OagvL4Mrc6XQWPgn2RrJa_mXlKXh81oVYsM,3462
|
9
9
|
tunned_geobr/read_ama_anemometric_towers.py,sha256=M3qKBTBYdqHzTuWtRrBiLA88Ymt6g0cf7sakJd5mTRo,4686
|
10
|
-
tunned_geobr/read_amazon.py,sha256=
|
10
|
+
tunned_geobr/read_amazon.py,sha256=HiwKnYebWe3nDMDRUqHpKJIO76bA4ERm4iJlCPhagQg,1286
|
11
11
|
tunned_geobr/read_amazon_ibas.py,sha256=RtOo5wPfc26S2HYJCLylNCPM5cHBOLGTP4uKEtGC3Bw,3500
|
12
12
|
tunned_geobr/read_apcb_amazon.py,sha256=IQZc_hyDcwYtRkQmdJMuQuZVcCGeuF9S5p3xeOghUgo,2834
|
13
13
|
tunned_geobr/read_apcb_caatinga.py,sha256=n1oQttcKkUyuU835VfbR709yGEydm8lnorp_uBlV-Ws,2846
|
@@ -62,6 +62,9 @@ tunned_geobr/read_health_region.py,sha256=zGkoQZ_mf-snBEy00RUd3GF_pJu6PIoqvcbS_i
|
|
62
62
|
tunned_geobr/read_heliports.py,sha256=liLQ5J7UgHcxcsx7xpkh_4oxxh4rNz7hprTwnWSViw4,2791
|
63
63
|
tunned_geobr/read_hydroelectric_feasibility_studies.py,sha256=tyCD-VyYW1paJLoN8woO_sR4aFC8NIIRj_As0jrQSLE,4770
|
64
64
|
tunned_geobr/read_hydroelectric_inventory_aai_studies.py,sha256=GWnSzsnMJSDjSpXFHyQbYL3d8xTwqh9ilxxi2r61idE,4814
|
65
|
+
tunned_geobr/read_ibama_embargoes.py,sha256=hzbWiifgoCgq7TP4X3H4TWFFkLnE5Y9969KUd3aJsek,3251
|
66
|
+
tunned_geobr/read_icmbio_embargoes.py,sha256=Xn3oxt4yK8wE6sAKWsU91EyU2h0yLysIbtQk2VUuJ5A,3107
|
67
|
+
tunned_geobr/read_icmbio_infractions.py,sha256=Heolqhuxc3sUby4RhxJZ88djIBWRcXkFbubhXgkpYos,3182
|
65
68
|
tunned_geobr/read_immediate_region.py,sha256=K-i5UBdxB1ZQw2R8fGMp1GqX5sXJwUkjVHqC84QtJtc,2555
|
66
69
|
tunned_geobr/read_indigenous_land.py,sha256=ZyHcJ93cDNjUcc5CyBKiWHjlrt9owDv993IFKUlEPZ4,1460
|
67
70
|
tunned_geobr/read_intermediate_region.py,sha256=PipeQFGVpZf6a_J7OrttPOnE7o6E5IJHJXLKvzYjoEY,2186
|
@@ -135,4 +138,4 @@ tunned_geobr/read_water_bodies_ana.py,sha256=Z-dpTPVgRHVndTeSFxx8uXn7ufMg2jm0Dlz
|
|
135
138
|
tunned_geobr/read_waterways.py,sha256=mEdoVogYWr5EYZ8bE3xMCVWyLrHYU7xTL2lUE0XbDAM,2951
|
136
139
|
tunned_geobr/read_weighting_area.py,sha256=m2X5Ua3jRqLlkqCQbIzR2jmo58pzqkyR3UYcGtgy20E,2325
|
137
140
|
tunned_geobr/utils.py,sha256=WT9PSGWvcERjj3yhfTvyWSE5ZiEjO4tYK5xIj5jJCg8,8170
|
138
|
-
tunned_geobr-0.
|
141
|
+
tunned_geobr-1.0.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|