⚲
Project
General
Profile
Sign in
Register
Home
Projects
Imprint + Privacy Policy
Help
Search
:
CDO
All Projects
CDO
Overview
Activity
News
Wiki
Forums
Files
Documentation
Download (573 Bytes)
RE: converting .csv to .nc to perform time-based statistics
» kyle.rb
Ralf Mueller
, 2020-04-16 15:53
require
'cdo'
require
'parallel'
cdo
=
Cdo
.
new
inputs
=
File
.
open
(
ARGV
[
0
]).
readlines
.
map
(
&
:chomp
).
map
(
&
:split
)
Parallel
.
each
(
inputs
,
in_threads:
12
)
{
|
input
|
year
,
month
,
day
,
hour
,
*
values
=
input
puts
'############################## '
+
year
values
.
each_with_index
{
|
value
,
index
|
cdo
.
settaxis
(
"
#{
year
}
-
#{
month
}
-
#{
day
}
,
#{
hour
}
:00:00,1hours"
,
input:
"-setname,var
#{
index
}
-const,
#{
value
}
,r1x1"
,
output:
"var
#{
index
}
_
#{
year
}
-
#{
month
}
-
#{
day
}
_
#{
hour
}
.nc"
,
options:
'-f nc'
)
}
}
(
0
..
7
).
each
{
|
i
|
cdo
.
cat
(
input:
Dir
.
glob
(
"var
#{
i
}
_*.nc"
).
sort
,
output:
"VAR
#{
i
}
.nc"
)
}
« Previous
1
…
5
6
7
Next »
(7-7/7)
Loading...