Skip to content

Commit

Permalink
working on Sargassum indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
MandyKarnauskas-NOAA committed Jun 28, 2024
1 parent f2d01da commit 623084e
Show file tree
Hide file tree
Showing 9 changed files with 17,058 additions and 514 deletions.
512 changes: 0 additions & 512 deletions .Rhistory

This file was deleted.

Binary file not shown.
Binary file modified indicator_data/TCRMP/fish_density_USVI.RData
Binary file not shown.
Binary file modified indicator_data/TCRMP/slopeSizeSpec_USVI.RData
Binary file not shown.
Binary file added indicator_objects/disturbance.RData
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ind <- list(labels = indnames, indicators = inddata, datelist = datdata) #, ulim
class(ind) <- "indicatordata"
plotIndicatorTimeSeries(ind, coltoplot = 1:3, plotrownum = 3, sublabel = T, sameYscale = F)

save(ind, file = "indicator_objects/mean_Lmax.RData")
# save(ind, file = "indicator_objects/mean_Lmax.RData")

Lmax <- mat

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ for (j in sitelis) {
mat[i, 3:12] <- c(su2, su[3:length(su)])
mat[i, 13] <- sum(f1$Total, na.rm = T) }
}

dim(mat)
mat <- mat[-which(rowSums(mat[3:ncol(mat)]) == 0), ]
dim(mat)
Expand Down
49 changes: 48 additions & 1 deletion indicator_processing/non_automated/Sargassum_inundation.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,63 @@
#
# Sargassum inundation indicator
#
# direct download from ERDDAP
# https://cwcgom.aoml.noaa.gov/erddap/griddap/noaa_aoml_atlantic_oceanwatch_AFAI_7D.graph

# specification file and libraries -----------------------------

rm(list = ls())
dev.off()

library(lubridate)
library(maps)
library(plotTimeSeries)
library(rerddap)

load("indicator_processing/spec_file.RData")

# define years --------------------------------
styear <- 1961
styear <- 2012
enyear <- terminal_year

# get ERDDAP info --------------------------------
afai <- info('noaa_aoml_atlantic_oceanwatch_AFAI_7D',
url = 'https://cwcgom.aoml.noaa.gov/erddap')
afai

# download data --------------------

yr1 <- as.numeric(substr(afai$alldata$NC_GLOBAL$value[35], 1, 4)) + 1
yr2 <- as.numeric(substr(afai$alldata$NC_GLOBAL$value[34], 1, 4)) - 1
yr1
yr2

res <- griddap(afai, fields = 'AFAI',
time = c(paste0(yr1, '-01-01'), paste0(yr2, '-12-31')),
longitude = c(min_lon, max_lon),
latitude = c(min_lat, max_lat))

res$data$lim <- 0
res$data$lim [which(res$data$AFAI > 0.002)] <- 1

res$data$year <- substr(res$data$time, 1, 4)
res$data$tim <- substr(res$data$time, 1, 7)

head(res$data)

mon_afai <- tapply(res$data$lim, res$data$tim, sum, na.rm = T)
yr_afai <- tapply(res$data$lim, res$data$year, sum, na.rm = T)

plot(mon_afai, type = "l")
plot(2017:2023,
yr_afai, type = "l")

# create indicator object --------------

################# INCOMPLETE ########################
# need to look up algorithm to convert AFAI units to Area of inundation
# check Chuanmin write-up and find methods

# load data -------------------------------------

d <- read.csv("indicator_data/sargassum_innundation_monthly_mean_hu.csv", skip = 2)
Expand Down
Loading

0 comments on commit 623084e

Please sign in to comment.