Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gmGeostats
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geomet
gmGeostats
Commits
072179c4
Commit
072179c4
authored
3 years ago
by
Raimon Tolosana-Delgado
Browse files
Options
Downloads
Patches
Plain Diff
added methods for as.gmCgram
parent
e0b3f17d
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
DESCRIPTION
+1
-1
1 addition, 1 deletion
DESCRIPTION
NEWS.md
+4
-0
4 additions, 0 deletions
NEWS.md
R/gmAnisotropy.R
+6
-1
6 additions, 1 deletion
R/gmAnisotropy.R
R/gstatCompatibility.R
+33
-1
33 additions, 1 deletion
R/gstatCompatibility.R
with
44 additions
and
3 deletions
DESCRIPTION
+
1
−
1
View file @
072179c4
Package: gmGeostats
Version: 0.10-8-900
0
Version: 0.10-8-900
1
Date: 2021-07-15
Title: Geostatistics for Compositional Analysis
Authors@R: c(person(given = "Raimon",
...
...
This diff is collapsed.
Click to expand it.
NEWS.md
+
4
−
0
View file @
072179c4
# gmGeostats 0.10.8-9001
*
(2021-07-22) conversion methods between variogram models:
`as.gmCgram()`
methods for "variogramModel" and "variogramModelList" objects (from package "gstat")
# gmGeostats 0.10.8-9000
*
(2021-07-15) documented abstract union classes, specifying required methods for the member classes
...
...
This diff is collapsed.
Click to expand it.
R/gmAnisotropy.R
+
6
−
1
View file @
072179c4
...
...
@@ -51,7 +51,12 @@ as.AnisotropyScaling.AnisotropyScaling = function(x) x
#' @export
as.AnisotropyScaling.numeric
=
function
(
x
){
if
(
length
(
x
)
==
2
)
return
(
anis2D.par2A
(
ratio
=
x
[
2
],
angle
=
x
[
1
]))
if
(
length
(
x
)
==
5
)
stop
(
"as.AnisotropyScaling: 3D from 5-vector values not yet implemented"
)
# return(anis3D.par2A(ratios=x[4:5], angles=x[1:3]))
if
(
length
(
x
)
==
5
){
if
(
sum
(
(
x
[
4
:
5
]
-1
)
^
2
)
<
1e-12
){
return
(
diag
(
3
))
}
stop
(
"as.AnisotropyScaling: 3D from arbitrary 5-vector values not yet implemented"
)
# return(anis3D.par2A(ratios=x[4:5], angles=x[1:3]))
}
stop
(
"as.AnisotropyScaling.numeric: only works for length=2 1.angle+1.ratio, or lenth=5 3.angles+2.ratios"
)
}
...
...
This diff is collapsed.
Click to expand it.
R/gstatCompatibility.R
+
33
−
1
View file @
072179c4
...
...
@@ -699,7 +699,39 @@ as.LMCAnisCompo.variogramModelList <-
#' @describeIn as.gmCgram Convert theoretical structural functions to gmCgram format
#' @method as.gmCgram variogramModelList
as.gmCgram.variogramModelList
=
function
(
m
,
...
)
stop
(
"not yet available"
)
as.gmCgram.variogramModelList
=
function
(
m
,
...
){
as.gmCgram
(
as.LMCAnisCompo
(
m
,
...
),
...
)
}
#' @describeIn as.gmCgram Convert theoretical structural functions to gmCgram format
#' @method as.gmCgram variogramModel
as.gmCgram.variogramModel
=
function
(
m
,
...
){
# extract nugget
isNugget
=
m
$
model
==
"Nug"
if
(
any
(
isNugget
)){
nuggetValue
=
m
[
isNugget
,
"psill"
]
m
=
m
[
!
isNugget
,,
drop
=
FALSE
]
}
# extract model names
modelName
=
gsi.validModels
[
paste
(
"vg"
,
m
$
model
,
sep
=
"."
)]
# if any model name is not identified
if
(
any
(
is.na
(
modelName
))){
stop
(
"as.gmCgram.variogramModel: found an unidentified variogram model; check content of internal variable gsi.valiModels to see which models are permissible"
)
}
# otherwise, extract parametres
tt
=
function
(
x
)
t
(
t
(
x
))
out
=
setCgram
(
type
=
modelName
[
1
],
nugget
=
tt
(
nuggetValue
),
sill
=
tt
(
m
[
1
,
"psill"
]),
anisRanges
=
as.AnisotropyScaling
(
unlist
(
m
[
1
,
-
(
1
:
4
)])),
extraPar
=
m
[
1
,
"kappa"
])
if
(
nrow
(
m
)
>
1
){
for
(
im
in
1
:
nrow
(
m
)){
out
=
out
+
setCgram
(
type
=
modelName
[
im
],
sill
=
tt
(
m
[
im
,
"psill"
]),
anisRanges
=
as.AnisotropyScaling
(
unlist
(
m
[
im
,
-
(
1
:
4
)])),
extraPar
=
m
[
im
,
"kappa"
])
}
}
return
(
out
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment