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
startR
Commits
4b2d76a0
Commit
4b2d76a0
authored
May 06, 2022
by
nperez
Browse files
Fix to new startR version and manually create obs file_date
parent
06406453
Pipeline
#7126
failed with stage
in 53 minutes and 53 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
inst/doc/figures/subseasonal_5.png
View replaced file @
06406453
View file @
4b2d76a0
492 KB
|
W:
|
H:
449 KB
|
W:
|
H:
2-up
Swipe
Onion skin
inst/doc/usecase/ex3_1_SubseasonalECVHindcast.md
View file @
4b2d76a0
...
...
@@ -62,22 +62,36 @@ The time attributes returned by Start() are then used to define the correspondin
```
r
# Corresponding ERA5
dates
<-
attr
(
exp
,
'Variables'
)
$
common
$
time
#20*4*103=8240 middle day of weekly averages
file_date
<-
sapply
(
dates
,
format
,
'%Y%m%d'
)
dim
(
file_date
)
<-
c
(
length
(
sdates.seq
),
20
,
4
)
names
(
dim
(
file_date
))
<-
c
(
'sdate'
,
'syear'
,
'time'
)
## Generate the syears from the sdates.seq
syears
<-
t
(
sapply
(
sdates.seq
,
function
(
x
)
{
year
<-
as.numeric
(
substr
(
x
,
1
,
4
))
syears
<-
paste0
((
year
-20
)
:
(
year
-1
),
substr
(
x
,
5
,
8
))
}))
names
(
dim
(
syears
))
<-
c
(
'sdate'
,
'syear'
)
## Generate the times from the syears
Sys.setenv
(
TZ
=
'UTC'
)
# this helps to get UTC times
times
<-
lapply
(
syears
,
function
(
x
)
{
x
<-
as.Date
(
x
,
format
=
"%Y%m%d"
,
tz
=
"UTC"
)
x
<-
seq
(
x
,
x
+
25
,
by
=
'week'
)
format
(
x
,
"%Y%m%d"
)
})
times
<-
Reduce
(
c
,
times
)
dim
(
times
)
<-
c
(
time
=
4
,
sdate
=
103
,
syear
=
20
)
times
<-
s2dv
::
Reorder
(
times
,
c
(
2
,
3
,
1
))
obs_path
<-
paste0
(
"/esarchive/recon/ecmwf/era5/weekly_mean/"
,
"$var$_f1h-240x121/$var$_$file_date$.nc"
)
obs
<-
Start
(
dat
=
obs_path
,
var
=
'tas'
,
file_date
=
file_date
,
# sdate syear time
# 103 20 4
file_date
=
times
,
latitude
=
indices
(
1
:
121
),
longitude
=
indices
(
1
:
240
),
split_multiselected_dims
=
TRUE
,
return_vars
=
list
(
latitude
=
NULL
,
longitude
=
NULL
,
time
=
'file_date'
),
retrieve
=
FALSE
)
```
...
...
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