Skip to content

Commit 1026883

Browse files
authored
Merge pull request #181 from weecology/schema_field
Limit field names to ten characters
2 parents 262fab2 + 7d9ab38 commit 1026883

File tree

7 files changed

+31
-30
lines changed

7 files changed

+31
-30
lines changed

App/Zooniverse/functions.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ plot_nests<-function(df, bird_df, MAPBOX_ACCESS_TOKEN){
166166

167167
m<-leaflet(data=df) %>%
168168
addProviderTiles("MapBox", layerId = "mapbox_id",options = providerTileOptions(id = mapbox_tileset, minZoom = 8, maxNativeZoom=24, maxZoom = 24, accessToken = MAPBOX_ACCESS_TOKEN)) %>%
169-
addCircles(stroke = T,fillOpacity = 0.1,radius = 0.5,popup = ~htmlEscape(paste(round(sum_top1_s/num_obs_to,2),nest_id,sep=":"))) %>%
169+
addCircles(stroke = T,fillOpacity = 0.1,radius = 0.5,popup = ~htmlEscape(paste(round(sum_top1/num_obs_to,2),nest_id,sep=":"))) %>%
170170
addCircles(data = bird_df, stroke = T, fillOpacity = 0, radius = 0.2, color = ~species_colors(label),
171171
popup = ~htmlEscape(paste(round(score,2), bird_id, sep=":")))
172172
return(m)
@@ -193,7 +193,7 @@ update_nests<-function(mapbox_tileset, df, bird_df, show_nests, show_birds,
193193
}
194194
if (show_nests) {
195195
map <- map %>%
196-
addCircles(data=df,stroke = T,fillOpacity = 0.1,radius = 0.5,popup = ~htmlEscape(paste(round(sum_top1_s/num_obs_to,2),nest_id,sep=", ")))
196+
addCircles(data=df,stroke = T,fillOpacity = 0.1,radius = 0.5,popup = ~htmlEscape(paste(round(sum_top1/num_obs_to,2),nest_id,sep=", ")))
197197
}
198198
if (show_birds) {
199199
map <- map %>%

Zooniverse/Snakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ rule all:
3838
zip, site=SITES, year=YEARS, flight=FLIGHTS),
3939
expand(f"{working_dir}/processed_nests/{{year}}/{{site}}/{{site}}_{{year}}_processed_nests.shp",
4040
zip, site=SITES, year=YEARS),
41-
expand(f"{working_dir}/mapbox/{{year}}/{{site}}/{{flight}}.mbtiles",
41+
expand(f"{working_dir}/mapbox/last_uploaded/{{year}}/{{site}}/{{flight}}.mbtiles",
4242
zip, site=SITES, year=YEARS, flight=FLIGHTS)
4343

4444

@@ -131,7 +131,7 @@ rule upload_mapbox:
131131
input:
132132
f"{working_dir}/mapbox/{{year}}/{{site}}/{{flight}}.mbtiles"
133133
output:
134-
f"{working_dir}/mapbox/{{year}}/{{site}}/{{flight}}.mbtiles"
134+
touch(f"{working_dir}/mapbox/last_uploaded/{{year}}/{{site}}/{{flight}}.mbtiles")
135135
conda:
136136
"EvergladesTools"
137137
shell:

Zooniverse/combine_nests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def load_shapefile(x):
3131
'last_obs': 'str',
3232
'num_obs': 'int',
3333
'species': 'str',
34-
'sum_top1_s': 'float',
35-
'num_obs_to': 'int',
34+
'sum_top1': 'float',
35+
'num_top1': 'int',
3636
'bird_match': 'str'
3737
})
3838
shp["site"] = get_site(x)

Zooniverse/nest_detection.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ def compare_site(gdf):
6868
# add target info to match
6969
row = geopandas.GeoDataFrame(pd.DataFrame(row).transpose(), crs=matches.crs)
7070
matches = geopandas.GeoDataFrame(pd.concat([matches, row], ignore_index=True))
71-
matches["target_index"] = index
71+
matches["target_ind"] = index
7272
matches = matches.rename(columns={
73-
"xmin": "matched_xmin",
74-
"max": "matched_xmax",
75-
"ymin": "matched_ymin",
76-
"ymax": "matched_ymax"
73+
"xmin": "match_xmin",
74+
"xmax": "match_xmax",
75+
"ymin": "match_ymin",
76+
"ymax": "match_ymax"
7777
})
7878

7979
results.append(matches)
@@ -82,8 +82,8 @@ def compare_site(gdf):
8282
results = pd.concat(results)
8383
else:
8484
results = pd.DataFrame(columns=[
85-
'matched_xmin', 'matched_ymin', 'xmax', 'matched_ymax', 'label', 'score', 'image_path', 'Date', 'bird_id',
86-
'target_index', 'geometry'
85+
'match_xmin', 'match_ymin', 'match_xmax', 'match_ymax', 'label', 'score', 'image_path', 'Site', 'Date',
86+
'Year', 'event', 'file_posts', 'bird_id', 'target_ind'
8787
])
8888

8989
return results
@@ -102,19 +102,20 @@ def detect_nests(bird_detection_file, year, site, savedir):
102102
schema = {
103103
"geometry": "Polygon",
104104
"properties": {
105-
'matched_xmin': 'float',
106-
'matched_ymin': 'float',
107-
'xmax': 'float',
108-
'matched_ymax': 'float',
105+
'match_xmin': 'float',
106+
'match_ymin': 'float',
107+
'match_xmax': 'float',
108+
'match_ymax': 'float',
109109
'label': 'str',
110110
'score': 'float',
111111
'image_path': 'str',
112112
'Site': 'str',
113113
'Date': 'str',
114114
'Year': 'str',
115-
'bird_id': 'int',
116115
'event': 'str',
117-
'target_index': 'int'
116+
'file_posts': 'str',
117+
'bird_id': 'int',
118+
'target_ind': 'int'
118119
}
119120
}
120121
if not results.empty:

Zooniverse/process_nests.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ def process_nests(nest_file, year, site, savedir, min_score=0.3, min_detections=
5555
top_score_data = summed_scores[summed_scores['sum'] == max(summed_scores['sum'])].reset_index()
5656
nest_info = nest_data.groupby(['Site', 'Year', 'target_ind']).agg({
5757
'Date': ['min', 'max', 'count'],
58-
'matched_xm': ['mean'],
59-
'matched_ym': ['mean'],
60-
'xmax': ['mean'],
61-
'matched__1': ['mean']
58+
'match_xmin': ['mean'],
59+
'match_ymin': ['mean'],
60+
'match_xmax': ['mean'],
61+
'match_ymax': ['mean']
6262
}).reset_index()
63-
xmean = (nest_info['matched_xm']['mean'][0] + nest_info['xmax']['mean']) / 2
64-
ymean = (nest_info['matched_ym']['mean'][0] + nest_info['matched__1']['mean']) / 2
63+
xmean = (nest_info['match_xmin']['mean'][0] + nest_info['match_xmax']['mean']) / 2
64+
ymean = (nest_info['match_ymin']['mean'][0] + nest_info['match_ymax']['mean']) / 2
6565
bird_match = ",".join([str(x) for x in nest_data["bird_id"]])
6666
nests.append([
6767
target_ind, nest_info['Site'][0], nest_info['Year'][0], xmean[0], ymean[0], nest_info['Date']['min'][0],
@@ -77,7 +77,7 @@ def process_nests(nest_file, year, site, savedir, min_score=0.3, min_detections=
7777
nests = pd.DataFrame(nests,
7878
columns=[
7979
'nest_id', 'Site', 'Year', 'xmean', 'ymean', 'first_obs', 'last_obs', 'num_obs',
80-
'species', 'sum_top1_score', 'num_obs_top1', 'bird_match'
80+
'species', 'sum_top1', 'num_top1', 'bird_match'
8181
])
8282
nests_shp = geopandas.GeoDataFrame(nests, geometry=geopandas.points_from_xy(nests.xmean, nests.ymean))
8383
nests_shp.crs = nests_data.crs
@@ -95,8 +95,8 @@ def process_nests(nest_file, year, site, savedir, min_score=0.3, min_detections=
9595
'last_obs': 'str',
9696
'num_obs': 'int',
9797
'species': 'str',
98-
'sum_top1_score': 'float',
99-
'num_obs_top1': 'int',
98+
'sum_top1': 'float',
99+
'num_top1': 'int',
100100
'bird_match': 'str'
101101
}
102102
}

Zooniverse/upload_mapbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def retrieve_upload_status(self, upload_id):
5656

5757
def get_credentials():
5858
"""Get credentials from mapbox.ini"""
59-
with open("/blue/ewhite/everglades/mapbox/mapbox.ini", "rb") as f:
59+
with open("/blue/ewhite/everglades/mapbox.ini", "rb") as f:
6060
toml_dict = tomli.load(f)
6161
access_token = toml_dict['mapbox']['access-token']
6262
return access_token

everglades_workflow.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#SBATCH --mail-type=FAIL
55
#SBATCH --gpus=a100:4
66
#SBATCH --cpus-per-task=60
7-
#SBATCH --mem=1200gb
7+
#SBATCH --mem=600gb
88
#SBATCH --time=80:00:00
99
#SBATCH --partition=gpu
1010
#SBATCH --output=/blue/ewhite/everglades/EvergladesTools/logs/everglades_workflow.out

0 commit comments

Comments
 (0)