Skip to content

Instantly share code, notes, and snippets.

Leonidas Liakos kokkytos

Block or report user

Report or block kokkytos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View stackApply.R.patch
--- stackApply.R 2019-11-27 09:12:08.000000000 +0200
+++ /home/leonidas/Desktop/raster_source/source/R/stackApply.R 2019-11-27 12:50:43.268272464 +0200
@@ -84,9 +84,9 @@
}
if (rowcalc) {
- v <- lapply(uin, function(i) fun(a[, ind==uin[i], drop=FALSE], na.rm=na.rm))
+ v <- lapply(uin, function(i) fun(a[, ind==i, drop=FALSE], na.rm=na.rm))
} else {
- v <- lapply(uin, function(i, ...) apply(a[, ind==uin[i], drop=FALSE], 1, fun, na.rm=na.rm))
View calc_mean.R
# Calculate mean per day of week.
library(lubridate)
library(raster)
library(magrittr)
r <- raster(
nrows = 300,
@kokkytos
kokkytos / calc_median_wrong_results.R
Created Nov 23, 2019
The purpose is to compare whether the indexes of names from the result of the stackApply function correspond to the indexes that were defined as parameter input. An alternative method (ver_median function) is used for comparison.
View calc_median_wrong_results.R
# Calculate median per day of week.
library(lubridate)
library(raster)
library(magrittr)
r <- raster(nrows = 300, ncols = 300, res = 500,
xmn = 0,
xmx = 150000,
ymn = 0,
@kokkytos
kokkytos / calc_median.R
Created Nov 22, 2019
Calculate median per day of week
View calc_median.R
# Calculate median per day of week
library(lubridate)
library(raster)
library(magrittr)
r <- raster(nrows = 10, ncols = 10, res = 1,
xmn = 0,
xmx = 10,
ymn = 0,
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@kokkytos
kokkytos / rgibs.R
Last active Dec 1, 2019
[Λήψη δορυφορικών εικόνων στην R μέσω του GIBS API] #GIBS
View rgibs.R
library(gdalUtils)
rGIBS<-function(date=Sys.Date(), EPSGCODE,PRODUCT,projwin, outputdir=file.path(Sys.getenv("HOME"),"gibs_downloads"),...){
dir.create(outputdir, showWarnings = FALSE)
setwd(outputdir)
#generate xml
makeXML <- function(date, EPSGCODE,PRODUCT){
myxml<- sprintf('<GDAL_WMS><Service name="TiledWMS"><ServerUrl>https://gibs.earthdata.nasa.gov/twms/epsg%s/best/twms.cgi?</ServerUrl><TiledGroupName>%s tileset</TiledGroupName><Change key="${time}">%s</Change></Service></GDAL_WMS>',EPSGCODE, PRODUCT, date)
tmp <- tempfile(fileext=".xml")
fileConn<-file(tmp)
You can’t perform that action at this time.