Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Servet Ahmet Çizmeli committed Feb 21, 2020
2 parents 656c37c + c29eb47 commit fce8687
Show file tree
Hide file tree
Showing 102 changed files with 4,567 additions and 1,423 deletions.
9 changes: 7 additions & 2 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
^.*\.Rproj$
^\.Rproj\.user$
^anap.txt$
^anap_header.txt$
^geoSpectral.Rproj
^.*\.Rproj$ # Automatically added by RStudio,
^\.Rproj\.user$ # used for temporary files.
^NEWS\.md$ # A news file written in Markdown
^\.travis\.yml$ # Used for continuous integration testing with travis
49 changes: 32 additions & 17 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
Package: geoSpectral
Type: Package
Title: Classes and methods for spectral (optical) data
Version: 0.11
Date: 2012-07-02
Title: Classes and Methods for Working with Spectral Data with Space-Time Attributes
Version: 0.17.5
Date: 2020-02-17
Depends:
R (>= 2.10.0),
R (>= 2.10.0)
Imports:
methods,
rgdal,
dplyr,
spacetime,
reshape2
Author: Servet Cizmeli
Maintainer: Servet Cizmeli <[email protected]>
Description: This package provides S4 classes and basic manipulation methods
for datasets frequently used in remote sensing, bio-optical oceanography and
environmental and earth sciences. The package is based on the data type called
Spectra which extends the STIDF class of package spacetime. Spatial/temporal and
spectral aspects of Bio-Optical data that are regularly collected during Bio-
Optical oceanography campaigns can be easily represented with the Spectra class.
xts,
maps,
rgdal,
leaflet,
rbokeh,
plotly,
sp,
stats
Author: Servet Ahmet Cizmeli [aut, cre] (<https://orcid.org/0000-0001-6694-9305>)
Authors@R:
person("Servet Ahmet", "Cizmeli", , "[email protected]", c("aut", "cre"), comment = c(ORCID = "0000-0001-6694-9305"))
Maintainer: Servet Ahmet Cizmeli <[email protected]>
URL: https://github.com/PranaGeo/geoSpectral
BugReports: https://github.com/PranaGeo/geoSpectral/issues
Description: Provides S4 classes and data import, preprocessing, graphing,
manipulation and export methods for geo-Spectral datasets (datasets with space/time/spectral
dimensions). These type of data are frequently collected within earth observation projects
(remote sensing, spectroscopy, bio-optical oceanography, mining, agricultural, atmospheric,
environmental or similar branch of science).
License: GPL
LazyLoad: yes
Collate:
geoSpectral.R
SpcHeader-Class.R
SpcHeader-Methods.R
Spectra-Class.R
Spectra-Methods.R
SpcList-Class.R
SpcList-Methods.R
geoSpectral.R
RoxygenNote: 6.0.1
Suggests: testthat
Spectra-ImportFuns.R
RoxygenNote: 7.0.2
Suggests:
testthat,
xlsx,
geoSpectral
123 changes: 122 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1 +1,122 @@
exportPattern("^[[:alpha:]]+")
# Generated by roxygen2: do not edit by hand

export("spc.colnames<-")
export("spc.setheader<-")
export("spc.setinvalid.idx<-")
export("spc.setselected.idx<-")
export("spc.setwavelengths<-")
export(SpcHeaderAdd)
export(SpcList)
export(Spectra)
export(spc.Read_ASD)
export(spc.Read_NOMAD_v2)
export(spc.STI.stdistance)
export(spc.bbox2lines)
export(spc.cname.construct)
export(spc.colMeans)
export(spc.colnames)
export(spc.data2header)
export(spc.example_spectra)
export(spc.export.text)
export(spc.export.xlsx)
export(spc.getheader)
export(spc.getinvalid.idx)
export(spc.getselected.idx)
export(spc.getwavelengths)
export(spc.header.infos)
export(spc.header2data)
export(spc.import.text)
export(spc.interp.spectral)
export(spc.invalid.detect)
export(spc.lapply)
export(spc.lines)
export(spc.make.stindex)
export(spc.makeSpcList)
export(spc.plot)
export(spc.plot.depth)
export(spc.plot.depth.overlay)
export(spc.plot.depth.plotly)
export(spc.plot.grid)
export(spc.plot.map.leaflet)
export(spc.plot.map.plotly)
export(spc.plot.map.rbokeh)
export(spc.plot.overlay)
export(spc.plot.plotly)
export(spc.plot.time)
export(spc.plot.time.plotly)
export(spc.rbind)
export(spc.select)
export(spc.timeMatch)
export(spc.updateheader)
exportClasses(SpcHeader)
exportClasses(SpcHeaderList)
exportClasses(SpcList)
exportClasses(Spectra)
exportMethods("$")
exportMethods("spc.setheader<-")
exportMethods(dim)
exportMethods(head)
exportMethods(names)
exportMethods(ncol)
exportMethods(nrow)
exportMethods(rep)
exportMethods(show)
exportMethods(sort)
exportMethods(spc.data2header)
exportMethods(spc.getheader)
exportMethods(spc.header2data)
exportMethods(spc.invalid.detect)
exportMethods(spc.rbind)
exportMethods(spc.updateheader)
exportMethods(subset)
import(maps)
import(methods)
import(rgdal)
import(sp)
import(spacetime)
import(xts)
importClassesFrom(spacetime,STIDF)
importFrom(dplyr,"%>%")
importFrom(dplyr,everything)
importFrom(dplyr,select)
importFrom(grDevices,dev.new)
importFrom(grDevices,rainbow)
importFrom(graphics,abline)
importFrom(graphics,axis)
importFrom(graphics,box)
importFrom(graphics,grid)
importFrom(graphics,hist)
importFrom(graphics,legend)
importFrom(graphics,lines)
importFrom(graphics,locator)
importFrom(graphics,matlines)
importFrom(graphics,matplot)
importFrom(graphics,matpoints)
importFrom(graphics,mtext)
importFrom(graphics,par)
importFrom(graphics,plot.new)
importFrom(graphics,points)
importFrom(graphics,title)
importFrom(leaflet,"%>%")
importFrom(leaflet,addCircles)
importFrom(leaflet,addTiles)
importFrom(leaflet,leaflet)
importFrom(plotly,add_trace)
importFrom(plotly,layout)
importFrom(plotly,plot_ly)
importFrom(plotly,subplot)
importFrom(plotly,toRGB)
importFrom(rbokeh,"%>%")
importFrom(rbokeh,figure)
importFrom(rbokeh,ly_map)
importFrom(rbokeh,ly_points)
importFrom(sp,Line)
importFrom(sp,Lines)
importFrom(sp,SpatialPoints)
importFrom(sp,coordinates)
importFrom(sp,spDistsN1)
importFrom(stats,approx)
importFrom(stats,time)
importFrom(utils,modifyList)
importFrom(utils,read.table)
importFrom(utils,write.table)
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# geoSpectral 0.17.5 (2019-02-17)

## Package check warnings

* Fixed the warning during package check : `Documented arguments not in \usage in documentation object spc.setheader<-,list-method: ‘...’`

## Updated DESCRIPTION

* Added Orcid info to field : Author
* Added the field : Authors@R
* Added the field : URL
* Added the field : BugReports
22 changes: 18 additions & 4 deletions R/SpcHeader-Class.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# TODO: Add comment
#
# Author: acizmeli
###############################################################################

#########################################################################
# Class : SpcHeader
#########################################################################
#' \code{SpcHeader} class for header object storing metadata.
#' @description Definition for \code{SpcHeader}. This class is required
#' for the @header slot of \code{Spectra} object. This class directly inherits
#' R lists, so there is no additional slots.
#'
#' @examples
#' new("SpcHeader")
#' @export
setClass("SpcHeader", contains="list",
prototype=prototype(list(Station=NA,Cruise=NA,Latitude=NA,Longitude=NA)))
setMethod("initialize",
Expand All @@ -27,6 +31,16 @@ setValidity("SpcHeader", function(object){
#########################################################################
# Class : SpcHeaderList
#########################################################################
#' \code{SpcHeaderList} class.
#' @description Definition for \code{SpcHeaderList}. This class provides
#' a collection of multiple \code{SpcHeader} objects inside a list.
#'
#' @examples
#' h1 = new("SpcHeader")
#' h2 = new("SpcHeader")
#' as(list(h1, h2), "SpcHeaderList")
#' new("SpcHeaderList")
#' @export
setClass("SpcHeaderList", contains="list",
prototype=prototype(list(new("SpcHeader"))))

Expand Down
86 changes: 38 additions & 48 deletions R/SpcHeader-Methods.R
Original file line number Diff line number Diff line change
@@ -1,53 +1,28 @@
#########################################################################
# Method : spc.ScanFileName
#########################################################################
#Uses FileNameScanTemplate
#If there is Skip in the field name, it will be skipped
#Scan : A string, can be either of "DirName" or "FileName".
spc.ScanFileName = function(template, in.listnames,Scan) {
#Take the first instrument
out = SpcHeaderAdd(template, "InBaseName", basename(in.listnames))
out = SpcHeaderAdd(out, "InDirName", dirname(in.listnames))

mytemplate = switch(Scan,
DirName = "DirNameScanTemplate",
FileName = "FileNameScanTemplate")

if (is.character(template[[mytemplate]])){
for (I in 1:length(template[[mytemplate]])){

if(!grepl(template[[mytemplate]][I],"Skip", ignore.case=T)) {
if (class(out)=="SpcHeader")
EXT = out$extension
if (class(out)=="SpcHeaderList")
EXT = out[[1]]$extension
#Choose the directory name in the hierarchy that contains the tags
try(tags<- ExtractTagFromFilename(in.listnames, REV_TAGNO=template$ReverseDirTagNo, SEP="/"),silent=T)
if (!exists("tags") || is.null(tags))
tags = ExtractTagFromFilename(in.listnames, REV_TAGNO=1, SEP="/")

#Determine the tags in the input directory name
tags = ExtractTagFromFilename(tags, TAGNO=I, SEP="_", EXT)

#If it is the Date field, use DatesFromFilename() to convert it to an xts object
if(template[[mytemplate]][I]=="Date"){
temp = DatesFromFilename(tags, "Date", SORT=FALSE)
tags = temp$StartDate
}
tags = gsub(template[[mytemplate]][I],"",tags)
out = SpcHeaderAdd(out, template[[mytemplate]][I], tags)
rm(tags)
}
}
}
return(out)
}

#########################################################################
# Method : SpcHeaderAdd
#########################################################################
#' Set a field of the @header slot of a \code{SpcHeader} class object
#' @description Function add the value of a field in the header slot of \code{SpcHeader} class object
#'
#' @usage
#' SpcHeaderAdd (object,Name,Value,...)
#'
#' @param object of class SpcHeader
#' @param Name a character variable
#' @param Value a numeric variable
#' @param ... arguments to be passed to or from other methods
#' @examples
#' sp=spc.example_spectra()
#' sp@header
#' sp@ShortName
#' sp@header=SpcHeaderAdd(sp@header,sp@ShortName,10)
#' sp@header
#' @rdname SpcHeaderAdd
#' @export
setGeneric("SpcHeaderAdd",function(object,Name,Value,...)
{standardGeneric("SpcHeaderAdd")})
#' @rdname SpcHeaderAdd
setMethod("SpcHeaderAdd", signature="SpcHeader", function(object,Name,Value){
templist = list()
if (length(Value)>1){
Expand All @@ -69,18 +44,33 @@ setMethod("SpcHeaderAdd", signature="SpcHeader", function(object,Name,Value){
#' Show a SpcHeader object
#' @description Display a SpcHeader object
#'
#' @usage
#' show(object)
#'
#' @param object of class SpcHeader
#' @seealso \code{\link{show}}
#'
#' @examples
#' x=spc.example_spectra()
#' show(x@header)
#'
#' @export
setMethod("show", signature="SpcHeader", function(object){
fieldnames = names(object)
sapply(1:length(fieldnames), function(x) cat(paste(fieldnames[x], " : ",
object[fieldnames[x]], "\n")))
})
})
setGeneric(name="spc.export.text",
def=function(input,filename,writeheader=TRUE,sep=";",...) {standardGeneric("spc.export.text")})
setMethod("spc.export.text", signature="SpcHeader", definition=function(input,filename,append=F,sep=";",...){
nms = names(input)
nms = paste("Spectra|header",sep,nms,sep="")
browser()
out1 = lapply(input,function(x){
#If the separator character exists in the header, then eliminate it
x<-gsub(sep,"",x)
if(length(x)>1)
x<-paste(x,collapse=sep)
else
x<-as.character(x)
})
out1 = cbind(nms,out1)
write.table(out1,filename,row.names=F,col.names=F,append=append,quote=F,sep=sep)
})
8 changes: 8 additions & 0 deletions R/SpcList-Class.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#########################################################################
# Class : SpcList
#########################################################################
#' SpcList class definition
#' @description Definition for \code{SpcList}, a class to store multiple \code{Spectra}
#' objects inside a list-like object. See the help of the constructor function \code{\link{SpcList}}.
#' @slot .Data list, Inherited R list object
#' @slot by character, Determines the header field in the Spectra objects

#' within the SpcList that describes how they are different one from the other.
#' @export
setClass("SpcList",contains="list",
representation=representation(by="character"),
prototype=prototype(by="VariousVariables")
Expand Down
Loading

0 comments on commit fce8687

Please sign in to comment.