Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Earth Sciences
easyNCDF
Commits
95051724
Commit
95051724
authored
Jul 14, 2017
by
Nicolau Manubens
Browse files
Improved a2nc to store data types properly.
parent
9ef0bcf8
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/ArrayToNc.R
View file @
95051724
...
...
@@ -209,7 +209,15 @@ ArrayToNc <- function(arrays, file_path) {
var_info
[[
'longname'
]]
<-
var_info
[[
'longname'
]][
1
]
}
if
(
!
(
'prec'
%in%
names
(
var_info
)))
{
var_info
[[
'prec'
]]
<-
'float'
if
(
typeof
(
arrays
[[
i
]])
==
'logical'
)
{
var_info
[[
'prec'
]]
<-
'short'
}
else
if
(
typeof
(
arrays
[[
i
]])
==
'character'
)
{
var_info
[[
'prec'
]]
<-
'char'
}
else
if
(
typeof
(
arrays
[[
i
]])
==
'integer'
)
{
var_info
[[
'prec'
]]
<-
'integer'
}
else
{
var_info
[[
'prec'
]]
<-
'double'
}
}
else
{
if
(
!
is.character
(
var_info
[[
'prec'
]]))
{
stop
(
"The provided 'prec' for the "
,
j
,
"th variable in the "
,
i
,
"th array must be a character string."
)
...
...
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