From 4cddee24ac0221f0f40cf9781aa52640e3188e47 Mon Sep 17 00:00:00 2001 From: mcornec Date: Wed, 6 Dec 2023 09:49:01 -0800 Subject: [PATCH] Delete auxil/match_NCEP_II_local.R Merged with other match_NCEP functions in match_NCP.R --- auxil/match_NCEP_II_local.R | 41 ------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 auxil/match_NCEP_II_local.R diff --git a/auxil/match_NCEP_II_local.R b/auxil/match_NCEP_II_local.R deleted file mode 100644 index ebbb080..0000000 --- a/auxil/match_NCEP_II_local.R +++ /dev/null @@ -1,41 +0,0 @@ - -match_NCEP_II_surface <- function ( path, date ,longitude,latitude) { - match= rep(NaN,length(date)) - setwd(path) - file_name_all=dir() - year = year(Convert_matlabtime(date)) - year_unique <- unique (year) - i=1 - for ( i in 1: length ( year_unique) ) { - file_name_open <- grep( year_unique[i], - file_name_all, - value = TRUE) - # open the file and extract the variables - chla=nc_open( file_name_open); - sensible <- ncvar_get(chla, names(chla$var)[2]) - lon = ncvar_get(chla,"lon") - lat = ncvar_get(chla,"lat") - time = ncvar_get(chla,"time") - year_line = which (year== year_unique[i] ) - - for (ia in year_line ) { - - time_difference <- yday(Convert_matlabtime(date[ia])) # calculate the time different with each month - if (longitude[ia] <=0){ - lonn <- max (which ( lon<= (longitude[ia]+360) )) - } else{ - lonn <- max (which ( lon<= (longitude[ia]) )) - } - latt <- max ( which (lat>= latitude[ia] )) - match[ia] <- mean ( sensible[lonn,latt, time_difference]) # W m-2 - } - nc_close(chla) - rm( sensible) - } - - return(match) - -} - - -