Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Franssen, Wietse
WFRTools
Commits
25fe2a0e
Commit
25fe2a0e
authored
Aug 08, 2017
by
Franssen, Wietse
Browse files
remain array dimensions in ncLoad
parent
ddf47d3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/WFRTools.R
View file @
25fe2a0e
...
...
@@ -15,7 +15,7 @@ plotje <-function(data, title = NULL) {
title
=
paste0
(
data
$
Variable
$
longName
,
" ["
,
data
$
Variable
$
units
,
"]"
)
}
}
if
(
length
(
dim
(
data
$
Data
))
>
2
)
{
dataTmp
<-
aperm
(
data
$
Data
[
1
,,],
c
(
2
,
1
))
cat
(
"Plotting first timestep\n"
)
...
...
@@ -386,12 +386,12 @@ ncLoad <-function(file, varName = NULL, lonlatbox = NULL, timesteps = NULL, z =
## Fill data
if
(
is.null
(
z
))
{
if
(
!
is.null
(
ncFile
$
dim
$
time
))
{
data
$
Data
<-
ncvar_get
(
ncFile
,
varName
,
start
=
c
(
LonIdx
[
1
],
LatIdx
[
1
],
timeIdx
[
1
]),
count
=
c
(
length
(
LonIdx
),
length
(
LatIdx
),
length
(
timeIdx
)))
data
$
Data
<-
ncvar_get
(
ncFile
,
varName
,
start
=
c
(
LonIdx
[
1
],
LatIdx
[
1
],
timeIdx
[
1
]),
count
=
c
(
length
(
LonIdx
),
length
(
LatIdx
),
length
(
timeIdx
))
,
collapse_degen
=
F
)
}
else
{
data
$
Data
<-
ncvar_get
(
ncFile
,
varName
,
start
=
c
(
LonIdx
[
1
],
LatIdx
[
1
]),
count
=
c
(
length
(
LonIdx
),
length
(
LatIdx
)))
data
$
Data
<-
ncvar_get
(
ncFile
,
varName
,
start
=
c
(
LonIdx
[
1
],
LatIdx
[
1
]),
count
=
c
(
length
(
LonIdx
),
length
(
LatIdx
))
,
collapse_degen
=
F
)
}
}
else
{
data
$
Data
<-
ncvar_get
(
ncFile
,
varName
,
start
=
c
(
LonIdx
[
1
],
LatIdx
[
1
],
z
,
timeIdx
[
1
]),
count
=
c
(
length
(
LonIdx
),
length
(
LatIdx
),
1
,
length
(
timeIdx
)))
data
$
Data
<-
ncvar_get
(
ncFile
,
varName
,
start
=
c
(
LonIdx
[
1
],
LatIdx
[
1
],
z
,
timeIdx
[
1
]),
count
=
c
(
length
(
LonIdx
),
length
(
LatIdx
),
1
,
length
(
timeIdx
))
,
collapse_degen
=
F
)
}
##WFF
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment