Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
- name: Download occurrence data
run: julia --project scripts/get_occurrences.jl
- name: Upload occurrence data
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
with:
name: occurrence_data
name: project_data
path: occurrences.csv
draw_the_figure:
needs: [get_data]
Expand All @@ -44,29 +44,25 @@ jobs:
- name: Donwload occurrence data
uses: actions/download-artifact@v2
with:
name: occurrence_data
name: project_data
- name: Make the figure
run: python scripts/make_plot.py
- name: Upload map
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
with:
name: map
name: project_data
path: map.png
publish_webpage:
needs: [get_data, draw_the_figure]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download occurrence data
uses: actions/download-artifact@v2
with:
name: occurrence_data
path: dist
- name: Download map
- name: Download data
uses: actions/download-artifact@v2
with:
name: map
name: project_data
path: dist
- name: Deploy the webpage from the dist folder
uses: peaceiris/actions-gh-pages@v3
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
"DataFramesMeta" = "1313f7d8-7da2-5740-9ea0-a2ca25f37964"
22 changes: 7 additions & 15 deletions scripts/get_occurrences.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import GBIF
using DataFrames
using DataFramesMeta
import CSV


Expand All @@ -16,21 +17,12 @@ GBIF.occurrences!(occ)
GBIF.occurrences!(occ)
GBIF.occurrences!(occ)

raw_data = DataFrame(occ)
data = @linq DataFrame(occ) |>
where(:rank .== "SPECIES") |>
select([:name, :longitude, :latitude]) |>
where(:name .∈ ["Amphiprion ".*["melanopus", "ocellaris", "clarkii"]]) |>
where(:longitude .> 0.0)


# JUDGE NOT LEST YE BE JUDGED
raw_data = raw_data[raw_data.rank .== "SPECIES", :]
# Seriously
ok_names = "Amphiprion ".*["melanopus", "ocellaris", "clarkii"]
# It's 10pm
ok_index = map(f -> in(f, ok_names), raw_data.name)
# I'm so tired
raw_data = raw_data[ok_index, :]
# Can 2020 be over yet, please?
raw_data = raw_data[raw_data.longitude.>=0.0, :]
# I really should have used Query.jl or DataFramesMeta.jl is what I'm trying to say

# Save only the columns we care about
data = select(raw_data, [:name, :longitude, :latitude])
CSV.write("occurrences.csv", data; writeheader=true)