tunned-geobr 0.2.0__py3-none-any.whl → 0.2.2__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.
@@ -1,39 +1,117 @@
1
- from requests import get
2
1
  import pandas as pd
3
- from io import StringIO
4
- from urllib.error import HTTPError
5
- import re
2
+ from tabulate import tabulate
6
3
 
7
4
  def list_geobr():
8
- """Prints available functions, according to latest README.md file
9
-
10
- Example output
11
- ------------------------------
12
- Function: read_immediate_region
13
- Geographies available: Immediate region
14
- Years available: 2017
15
- Source: IBGE
16
- ------------------------------
17
-
5
+ """Lists all available datasets in the tunned_geobr package.
6
+
7
+ This function displays a comprehensive table of all geographic datasets
8
+ available in the tunned_geobr package, including information about the
9
+ geographies, years, and sources.
10
+
11
+ Returns
12
+ -------
13
+ pandas.DataFrame
14
+ A DataFrame containing information about all available datasets
15
+
16
+ Example
17
+ -------
18
+ >>> from tunned_geobr import list_geobr
19
+ >>> datasets = list_geobr()
18
20
  """
21
+
22
+ # Create a comprehensive list of all datasets
23
+ datasets = [
24
+ # Original geobr datasets
25
+ {"Function": "read_country", "Geography": "Country", "Years": "All", "Source": "IBGE"},
26
+ {"Function": "read_region", "Geography": "Region", "Years": "All", "Source": "IBGE"},
27
+ {"Function": "read_state", "Geography": "State", "Years": "All", "Source": "IBGE"},
28
+ {"Function": "read_state_direct", "Geography": "State (direct)", "Years": "All", "Source": "IBGE"},
29
+ {"Function": "read_meso_region", "Geography": "Meso region", "Years": "1991, 2000, 2010, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020", "Source": "IBGE"},
30
+ {"Function": "read_micro_region", "Geography": "Micro region", "Years": "1991, 2000, 2010, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020", "Source": "IBGE"},
31
+ {"Function": "read_immediate_region", "Geography": "Immediate region", "Years": "2017, 2019, 2020", "Source": "IBGE"},
32
+ {"Function": "read_intermediate_region", "Geography": "Intermediate region", "Years": "2017, 2019, 2020", "Source": "IBGE"},
33
+ {"Function": "read_municipality", "Geography": "Municipality", "Years": "All", "Source": "IBGE"},
34
+ {"Function": "read_municipality_direct", "Geography": "Municipality (direct)", "Years": "All", "Source": "IBGE"},
35
+ {"Function": "read_weighting_area", "Geography": "Census weighting area", "Years": "2010", "Source": "IBGE"},
36
+ {"Function": "read_census_tract", "Geography": "Census tract", "Years": "2000, 2010", "Source": "IBGE"},
37
+ {"Function": "read_census_tract_2022", "Geography": "Census tract 2022", "Years": "2022", "Source": "IBGE"},
38
+ {"Function": "read_statistical_grid", "Geography": "Statistical grid", "Years": "2010", "Source": "IBGE"},
39
+ {"Function": "read_comparable_areas", "Geography": "Comparable areas", "Years": "1872, 1900, 1911, 1920, 1933, 1940, 1950, 1960, 1970, 1980, 1991, 2000, 2010", "Source": "IBGE"},
40
+ {"Function": "read_health_region", "Geography": "Health region", "Years": "1991, 1994, 1997, 2001, 2005, 2013", "Source": "DataSUS"},
41
+ {"Function": "read_metro_area", "Geography": "Metropolitan area", "Years": "All", "Source": "IBGE"},
42
+ {"Function": "read_urban_area", "Geography": "Urban area", "Years": "2005, 2015", "Source": "IBGE"},
43
+ {"Function": "read_urban_concentrations", "Geography": "Urban concentrations", "Years": "All", "Source": "IBGE"},
44
+ {"Function": "read_amazon", "Geography": "Amazon", "Years": "All", "Source": "IBGE, MMA, and others"},
45
+ {"Function": "read_biomes", "Geography": "Biomes", "Years": "2004, 2019", "Source": "IBGE"},
46
+ {"Function": "read_conservation_units", "Geography": "Conservation units", "Years": "All", "Source": "MMA"},
47
+ {"Function": "read_disaster_risk_area", "Geography": "Disaster risk areas", "Years": "2010", "Source": "CEMADEN and IBGE"},
48
+ {"Function": "read_indigenous_land", "Geography": "Indigenous lands", "Years": "All", "Source": "FUNAI"},
49
+ {"Function": "read_semiarid", "Geography": "Semi-arid region", "Years": "All", "Source": "IBGE and others"},
50
+ {"Function": "read_health_facilities", "Geography": "Health facilities", "Years": "All", "Source": "DataSUS"},
51
+ {"Function": "read_neighborhood", "Geography": "Neighborhood", "Years": "2010", "Source": "IBGE"},
52
+ {"Function": "read_neighborhoods_2022", "Geography": "Neighborhoods 2022", "Years": "2022", "Source": "IBGE"},
53
+ {"Function": "read_schools", "Geography": "Schools", "Years": "All", "Source": "INEP"},
54
+ {"Function": "read_ports", "Geography": "Ports", "Years": "All", "Source": "Ministério da Infraestrutura"},
55
+ {"Function": "read_municipal_seat", "Geography": "Municipal seats", "Years": "All", "Source": "IBGE"},
56
+ {"Function": "read_pop_arrangements", "Geography": "Population arrangements", "Years": "2015", "Source": "IBGE"},
57
+ {"Function": "read_rppn", "Geography": "Private Natural Heritage Reserves", "Years": "All", "Source": "ICMBio"},
58
+ {"Function": "read_settlements", "Geography": "Rural settlements", "Years": "All", "Source": "INCRA"},
59
+
60
+ # Additional datasets in tunned_geobr
61
+ {"Function": "read_mining_processes", "Geography": "Mining processes", "Years": "All", "Source": "ANM"},
62
+ {"Function": "read_ebas", "Geography": "Endemic Bird Areas", "Years": "All", "Source": "Global Forest Watch"},
63
+ {"Function": "read_vegetation", "Geography": "Brazilian Vegetation", "Years": "All", "Source": "IBGE"},
64
+ {"Function": "read_transmission_lines_ons", "Geography": "Transmission Lines", "Years": "All", "Source": "ONS"},
65
+ {"Function": "read_water_bodies_ana", "Geography": "Water Bodies", "Years": "All", "Source": "ANA"},
66
+ {"Function": "read_pan_strategic_areas", "Geography": "PAN Strategic Areas", "Years": "All", "Source": "ICMBio"},
67
+ {"Function": "read_geographic_regions", "Geography": "Geographic Regions", "Years": "All", "Source": "IBGE"},
68
+ {"Function": "read_biosphere_reserves", "Geography": "Biosphere Reserves", "Years": "All", "Source": "MMA"},
69
+ {"Function": "read_baze_sites", "Geography": "BAZE Sites", "Years": "2018", "Source": "MMA"},
70
+
71
+ # Environmental and conservation datasets
72
+ {"Function": "read_amazon_ibas", "Geography": "Amazon IBAs", "Years": "All", "Source": "SAVE Brasil"},
73
+ {"Function": "read_atlantic_forest_ibas", "Geography": "Atlantic Forest IBAs", "Years": "All", "Source": "SAVE Brasil"},
74
+ {"Function": "read_atlantic_forest_law_limits", "Geography": "Atlantic Forest Law Limits", "Years": "All", "Source": "MMA/IBGE"},
75
+ {"Function": "read_apcb_amazon", "Geography": "APCB Amazon", "Years": "All", "Source": "MMA"},
76
+ {"Function": "read_apcb_caatinga", "Geography": "APCB Caatinga", "Years": "All", "Source": "MMA"},
77
+ {"Function": "read_apcb_cerrado_pantanal", "Geography": "APCB Cerrado/Pantanal", "Years": "All", "Source": "MMA"},
78
+ {"Function": "read_apcb_mata_atlantica", "Geography": "APCB Atlantic Forest", "Years": "All", "Source": "MMA"},
79
+ {"Function": "read_apcb_pampa", "Geography": "APCB Pampa", "Years": "All", "Source": "MMA"},
80
+ {"Function": "read_apcb_zcm", "Geography": "APCB Coastal/Marine", "Years": "All", "Source": "MMA"},
81
+
82
+ # Geological and natural features datasets
83
+ {"Function": "read_natural_caves", "Geography": "Natural Caves", "Years": "All", "Source": "ICMBio"},
84
+ {"Function": "read_cave_potential", "Geography": "Cave Potential", "Years": "All", "Source": "ICMBio"},
85
+ {"Function": "read_fossil_occurrences", "Geography": "Fossil Occurrences", "Years": "All", "Source": "SGB"},
86
+ {"Function": "read_archaeological_sites", "Geography": "Archaeological Sites", "Years": "All", "Source": "IPHAN"},
87
+ {"Function": "read_geology", "Geography": "Geology", "Years": "All", "Source": "CPRM"},
88
+ {"Function": "read_geomorphology", "Geography": "Geomorphology", "Years": "All", "Source": "IBGE"},
89
+ {"Function": "read_pedology", "Geography": "Pedology", "Years": "All", "Source": "IBGE"},
90
+ {"Function": "read_climate_aggressiveness", "Geography": "Climate Aggressiveness", "Years": "All", "Source": "IBGE"},
91
+
92
+ # Transportation and infrastructure datasets
93
+ {"Function": "read_public_aerodromes", "Geography": "Public Aerodromes", "Years": "All", "Source": "MapBiomas"},
94
+ {"Function": "read_private_aerodromes", "Geography": "Private Aerodromes", "Years": "All", "Source": "MapBiomas"},
95
+ {"Function": "read_state_highways", "Geography": "State Highways", "Years": "All", "Source": "MapBiomas"},
96
+ {"Function": "read_federal_highways", "Geography": "Federal Highways", "Years": "All", "Source": "MapBiomas"},
97
+ {"Function": "read_railways", "Geography": "Railways", "Years": "All", "Source": "MapBiomas"},
98
+ {"Function": "read_waterways", "Geography": "Waterways", "Years": "All", "Source": "SNIRH"},
99
+ {"Function": "read_heliports", "Geography": "Heliports", "Years": "All", "Source": "MapBiomas"},
100
+
101
+ # Land tenure and property datasets
102
+ {"Function": "read_snci_properties", "Geography": "SNCI Properties", "Years": "All", "Source": "INCRA"},
103
+ {"Function": "read_sigef_properties", "Geography": "SIGEF Properties", "Years": "All", "Source": "INCRA"},
104
+ {"Function": "read_quilombola_areas", "Geography": "Quilombola Areas", "Years": "All", "Source": "INCRA"}
105
+ ]
106
+
107
+ # Create DataFrame
108
+ df = pd.DataFrame(datasets)
109
+
110
+ # Display the table
111
+ print(tabulate(df, headers='keys', tablefmt='psql', showindex=False))
112
+
113
+ # Return the DataFrame for further use
114
+ return df
19
115
 
20
- try:
21
- html_data = get("https://github.com/ipeaGIT/geobr/blob/master/README.md").text
22
- find_emoji = html_data.index("👉")
23
- html_data = html_data[find_emoji:]
24
- escaped_data = html_data.replace("\\u003c", "<").replace("\\u003e", ">")
25
- tables = re.findall("<table>(.+?)</table>", escaped_data)
26
- available_datasets = "<table>" + tables[0].replace("\\n", "") + "</table>"
27
- df = pd.DataFrame(pd.read_html(StringIO(available_datasets))[0])
28
-
29
- except HTTPError:
30
- print(
31
- "Geobr url functions list is broken"
32
- 'Please report an issue at "https://github.com/ipeaGIT/geobr/issues"'
33
- )
34
-
35
- for i in range(len(df)):
36
- for each in df.columns:
37
- print(f"{each}: {df.loc[i, each]}")
38
-
39
- print("------------------------------")
116
+ if __name__ == "__main__":
117
+ list_geobr()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tunned-geobr
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Fork personalizado do geobr com funcionalidades extras como download de dados da ANM
5
5
  Author: Anderson Stolfi
6
6
  License: MIT
@@ -22,6 +22,7 @@ Requires-Dist: geobr<0.3.0,>=0.2.2
22
22
  Requires-Dist: patool>=1.15.0
23
23
  Requires-Dist: fiona>=1.10.1
24
24
  Requires-Dist: gdown>=5.2.0
25
+ Requires-Dist: tabulate>=0.9.0
25
26
  Description-Content-Type: text/markdown
26
27
 
27
28
  # geobr: Download Official Spatial Data Sets of Brazil
@@ -1,11 +1,11 @@
1
- tunned_geobr-0.2.0.dist-info/METADATA,sha256=UlxAYaMLKLBIuVp16M-RyewAXZbLf7Lj0eUq4dNgzdE,4987
2
- tunned_geobr-0.2.0.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- tunned_geobr-0.2.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- tunned_geobr-0.2.0.dist-info/licenses/LICENSE.txt,sha256=mECZRcbde3HssOKe1Co4zgqBLGVN0OWpTsEy3LIbcRA,75
1
+ tunned_geobr-0.2.2.dist-info/METADATA,sha256=e_X-ZIPmpkLULpa9wkiHpEahbflH1rKys-b8rEheoZs,5018
2
+ tunned_geobr-0.2.2.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ tunned_geobr-0.2.2.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ tunned_geobr-0.2.2.dist-info/licenses/LICENSE.txt,sha256=mECZRcbde3HssOKe1Co4zgqBLGVN0OWpTsEy3LIbcRA,75
5
5
  tunned_geobr/__init__.py,sha256=uxb92oXuVe5RRdfsRksj4rw0p0s0_H5k84t241qfu1g,3597
6
6
  tunned_geobr/constants.py,sha256=ZHj4pKtrxoUMFFgw-4ikuFcCkxEjzIbWL_gzhutGDB4,262
7
7
  tunned_geobr/data/grid_state_correspondence_table.csv,sha256=FpkBuX_-lRXQ1yBrQODxQgG9oha9Fd8A8zGKfdsDAmk,2660
8
- tunned_geobr/list_geobr.py,sha256=uIH11FOltrcjIQOqFk6uHgHj2moCWH_0vWyxbMj-xtA,1252
8
+ tunned_geobr/list_geobr.py,sha256=D0fKjZQGkF4olk3A7FOi5sic_qAMj_r5kkwZEpvsB4A,9382
9
9
  tunned_geobr/lookup_muni.py,sha256=ny1zU4i6OagvL4Mrc6XQWPgn2RrJa_mXlKXh81oVYsM,3462
10
10
  tunned_geobr/read_amazon.py,sha256=7o2uoJ-NAwsENAjoNTbR8AFIg_piEiWttpICPzkA9IM,1285
11
11
  tunned_geobr/read_amazon_ibas.py,sha256=RtOo5wPfc26S2HYJCLylNCPM5cHBOLGTP4uKEtGC3Bw,3500
@@ -79,4 +79,4 @@ tunned_geobr/read_water_bodies_ana.py,sha256=e8wQukpQABjyFCdqSWcFXXMdD-jmguELVJa
79
79
  tunned_geobr/read_waterways.py,sha256=mEdoVogYWr5EYZ8bE3xMCVWyLrHYU7xTL2lUE0XbDAM,2951
80
80
  tunned_geobr/read_weighting_area.py,sha256=fsV9pXWOw1X7XLS9SAUHVhKy6sw97EEXF5kWEEpFaZ8,2324
81
81
  tunned_geobr/utils.py,sha256=WT9PSGWvcERjj3yhfTvyWSE5ZiEjO4tYK5xIj5jJCg8,8170
82
- tunned_geobr-0.2.0.dist-info/RECORD,,
82
+ tunned_geobr-0.2.2.dist-info/RECORD,,