Skip to content

Commit

Permalink
Fixed the aut month error
Browse files Browse the repository at this point in the history
  • Loading branch information
brianburkenoaa committed May 6, 2024
1 parent fe82230 commit 95d9f83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/get_index.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ get_CMISST_index <- function(response, oceanData=oceanData_ERSST,
if (season==1) seasonal[,,yy]<-(oceanData[,,year_mo$month == 1 & year_mo$year==years[yy]]+oceanData[,,year_mo$month == 2 & year_mo$year==years[yy]]+oceanData[,,year_mo$month == 3 & year_mo$year==years[yy]])/3
if (season==2) seasonal[,,yy]<-(oceanData[,,year_mo$month == 4 & year_mo$year==years[yy]]+oceanData[,,year_mo$month == 5 & year_mo$year==years[yy]]+oceanData[,,year_mo$month == 6 & year_mo$year==years[yy]])/3
if (season==3) seasonal[,,yy]<-(oceanData[,,year_mo$month == 7 & year_mo$year==years[yy]]+oceanData[,,year_mo$month == 8 & year_mo$year==years[yy]]+oceanData[,,year_mo$month == 9 & year_mo$year==years[yy]])/3
if (season==4) seasonal[,,yy]<-(oceanData[,,year_mo$month == 10 & year_mo$year==years[yy]]+oceanData[,,year_mo$month == 11 & year_mo$year==years[yy]]+oceanData[,,year_mo$month == 11 & year_mo$year==years[yy]])/3
if (season==4) seasonal[,,yy]<-(oceanData[,,year_mo$month == 10 & year_mo$year==years[yy]]+oceanData[,,year_mo$month == 11 & year_mo$year==years[yy]]+oceanData[,,year_mo$month == 12 & year_mo$year==years[yy]])/3
}
# This scales (Z-score) the data cell-wise
# The aperm is needed because for some reason the apply function returns the third dimension (time) as the first dimension
Expand Down Expand Up @@ -78,11 +78,11 @@ get_CMISST_index <- function(response, oceanData=oceanData_ERSST,
colnames(index_cov)<-c("year","win.cov","spr.cov","sum.cov","aut.cov","val")

# Returns index as a list
# cmisst[[1]] contains 6 columns (as one list item): 4 seasonal indices, year, response
# cmisst[[1]] contains 6 columns (as one list item): year, 4 seasonal indices, response
# cmisst[[2]] winter spatial covariance values (for maps)
# cmisst[[3]] spring spatial covariance values (for maps)
# cmisst[[4]] summer spatial covariance values (for maps)
# cmisst[[5]] autumn spatial covariance values (for maps)
# cmisst[[6]] lat, long min and max, 1 list item
# cmisst[[6]] lat, long min and max, as 1 list item
return(list(index_cov, covs1, covs2, covs3, covs4, c(min.lat, max.lat, min.lon, max.lon)))
}

0 comments on commit 95d9f83

Please sign in to comment.