Spaces:
Running
Running
Matthias Mohr
commited on
Commit
•
3761383
1
Parent(s):
54447d6
Add data, small improvements
Browse files- data.parquet +3 -0
- fiboa/app.py +9 -5
- fiboa/query.py +1 -1
data.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:367c90899c7e636c6c205f77c107fc5af245fcdc85903cc69c60308906cef2c1
|
3 |
+
size 1303958329
|
fiboa/app.py
CHANGED
@@ -15,7 +15,7 @@ if os.path.exists("duck.db"):
|
|
15 |
if os.path.exists("duck.db.wal"):
|
16 |
os.remove("duck.db.wal")
|
17 |
|
18 |
-
geoparquet = "
|
19 |
con = ibis.connect("duckdb://duck.db", extensions = ["spatial"])
|
20 |
con.read_parquet(geoparquet, "crops").cast({"geometry": "geometry"})
|
21 |
# for code, url in DATA.items():
|
@@ -50,6 +50,9 @@ not query for columns that do not exist. Also, pay attention to which column is
|
|
50 |
Tables include {table_info}. The data you should use always comes from the table called "crops".
|
51 |
Only use that table, do not use the "testing" table. Pay close attention to this table schema.
|
52 |
|
|
|
|
|
|
|
53 |
Question: {input}
|
54 |
'''
|
55 |
)
|
@@ -63,9 +66,9 @@ chain = create_sql_query_chain(llm, db, prompt=new_prompt, k=100)
|
|
63 |
'''
|
64 |
Ask me about fiboa data! Request "a map" to get map output, or table for tabular output, e.g.
|
65 |
|
66 |
-
-
|
67 |
-
-
|
68 |
-
-
|
69 |
|
70 |
'''
|
71 |
|
@@ -79,6 +82,7 @@ with st.container():
|
|
79 |
st.divider()
|
80 |
|
81 |
'''
|
82 |
-
Data sources: https://
|
|
|
83 |
Software License: BSD
|
84 |
'''
|
|
|
15 |
if os.path.exists("duck.db.wal"):
|
16 |
os.remove("duck.db.wal")
|
17 |
|
18 |
+
geoparquet = "data.parquet"
|
19 |
con = ibis.connect("duckdb://duck.db", extensions = ["spatial"])
|
20 |
con.read_parquet(geoparquet, "crops").cast({"geometry": "geometry"})
|
21 |
# for code, url in DATA.items():
|
|
|
50 |
Tables include {table_info}. The data you should use always comes from the table called "crops".
|
51 |
Only use that table, do not use the "testing" table. Pay close attention to this table schema.
|
52 |
|
53 |
+
The column area is in the unit hectares, you may need to convert it to other units, e.g. square meters.
|
54 |
+
The column perimeter is in the unit meters, you may need to convert it to other units, e.g. kilometers.
|
55 |
+
|
56 |
Question: {input}
|
57 |
'''
|
58 |
)
|
|
|
66 |
'''
|
67 |
Ask me about fiboa data! Request "a map" to get map output, or table for tabular output, e.g.
|
68 |
|
69 |
+
- Show a map with the 10 largest fields
|
70 |
+
- Show a table of the total area by crop type
|
71 |
+
- Compute the total area of all fields in km² and compute the percentage the total area of the baltic states (175015 km²)
|
72 |
|
73 |
'''
|
74 |
|
|
|
82 |
st.divider()
|
83 |
|
84 |
'''
|
85 |
+
Data sources: https://source.coop/fiboa
|
86 |
+
Data License: CC-BY-SA-4.0
|
87 |
Software License: BSD
|
88 |
'''
|
fiboa/query.py
CHANGED
@@ -32,7 +32,7 @@ def as_geopandas(con, response):
|
|
32 |
if 'geometry' in gdf.columns:
|
33 |
gdf = (gdf
|
34 |
.cast({"geometry": "geometry"})
|
35 |
-
.mutate(geometry = _.geometry.convert("EPSG:
|
36 |
.to_pandas()
|
37 |
).set_crs(epsg=4326, inplace=True)
|
38 |
else:
|
|
|
32 |
if 'geometry' in gdf.columns:
|
33 |
gdf = (gdf
|
34 |
.cast({"geometry": "geometry"})
|
35 |
+
.mutate(geometry = _.geometry.convert("EPSG:4326", "EPSG:4326"))
|
36 |
.to_pandas()
|
37 |
).set_crs(epsg=4326, inplace=True)
|
38 |
else:
|