This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def process_geojson_with_properties(input_filename, output_filename): | |
# Load the JSON file | |
with open(input_filename, "r") as file: | |
data = json.load(file) | |
# Extract all items under "results" | |
results = data.get("results", []) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from statsmodels.tsa.holtwinters import Holt | |
# Load the JSON data | |
with open("pyjamalude-years.json", "r") as file: | |
data = json.load(file) | |
''' | |
Estimate future observation counts based on laji.fi data |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File unique identifier;Prediction by Naturalis;Probability by Naturalis;True or false by Naturalis;Prediction by iNat;Probability by iNat;True or false by iNat | |
_test_set_3/(Acanthosomatidae) Elasmucha grisea Parent Bug_8.jpg;Elasmucha grisea;0.894348;1;Elasmucha grisea;0.314679;1 | |
_test_set_3/(Aphrophoridae) Aphrophora alni_3.jpg;Aphrophora alni;1;1;Aphrophora alni;0.410643;1 | |
_test_set_3/(Cercopidae) Cercopis vulnerata_2.jpg;Cercopis vulnerata;1;1;Cercopis vulnerata;0.460223;1 | |
_test_set_3/(Cicadellidae) Adarrus ocellaris_3.jpg;Errastunus ocellaris;0.973848;0;Speudotettix subfusculus;0.303513;0 | |
_test_set_3/(Cicadellidae) Aguriahana stellulata_4.jpg;Aguriahana stellulata;0.999827;1;Aguriahana;0.433531;1 | |
_test_set_3/(Cicadellidae) Arthaldeus pascuellus_4.jpg;Arthaldeus pascuellus;1;1;Graminella nigrifrons;0.347305;0 | |
_test_set_3/(Cicadellidae) Athysanus argentarius_5.jpg;Athysanus argentarius;0.999749;1;Athysanus argentarius;0.491078;1 | |
_test_set_3/(Cicadellidae) Batracomorphus irroratus_5.jpg;Iassus lanio;0.699501 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
from sklearn.preprocessing import MinMaxScaler | |
rarity_threshold = 100 | |
# Read datafile that has number of observations for each species | |
df = pd.read_csv('species_rarity.csv', sep='\t') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
# Load the csv file | |
df = pd.read_csv('rows_HBF.75704.tsv', sep='\t') | |
# Remove those without a day of year | |
df = df.dropna(subset=['Gathering.Conversions.DayOfYearBegin']) |
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 13 in line 1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fid;common_name_finnish;count;unique;min;max;range;sum;mean;median;stddev;minority;majority;q1;q3;iqr | |
187;tulipäähippiäinen;1;1;255,7875214;255,79;0,00;255,79;255,79;255,79;0,00;255,79;255,7875214;255,79;255,79;0,00 | |
201;puukiipijät;1;1;235,3859253;235,39;0,00;235,39;235,39;235,39;0,00;235,39;235,3859253;235,39;235,39;0,00 | |
222;hömötiainen × lapintiainen;1;1;210,9716034;210,97;0,00;210,97;210,97;210,97;0,00;210,97;210,9716034;210,97;210,97;0,00 | |
175;pikkusieppo;29;29;79,25;303,37;224,11;5629,43;194,12;185,46;64,38;79,25;79,25;148,34;245,10;96,77 | |
180;kanahaukka (alalaji gentilis);1;1;165,2255707;165,23;0,00;165,23;165,23;165,23;0,00;165,23;165,2255707;165,23;165,23;0,00 | |
195;idänuunilintu;13;13;9,39;293,14;283,74;2079,52;159,96;175,33;79,21;9,39;9,39;104,69;209,42;104,73 | |
8;hippiäinen;376;359;0,00;354,92;354,92;54432,47;144,77;142,78;77,85;0,67;0,00;94,62;193,35;98,73 | |
82;peukaloinen;353;347;0,00;357,88;357,88;50821,14;143,97;144,19;76,40;0,02;0,00;90,73;198,19;107,46 | |
69;sirittäjä;190;188;0,00;318,41;318,41;27312,49 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generates small maps of Finland with a dot at given coordinates. | |
import geopandas as gpd | |
import matplotlib.pyplot as plt | |
from pyproj import Proj, transform | |
# Load a GeoJSON file with outline of Finland into a GeoDataFrame | |
geojson = gpd.read_file('fin.geojson') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Script to download sound files from iNaturalist. | |
Mikko Heikkinen / Luomus, 2023-02-06 | |
Requires "requests" library. | |
input: iNat API URL with parameters | |
output: files divided into folders by taxon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from os import listdir | |
from PIL import Image | |
# get the path/directory | |
source_dir = "images/Carpocoris_fuscispinus" | |
target_dir = "images/carp_fusc_crop" | |
limit = 300 |