Newer
Older
#if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true')
context("Start() lat Reorder test")
#1 selector type 1-values(list) 2-values(vector) 3-indices 4-'all' 5-mix
#2 selector range 1-[10, 20] 2-[20, 10] 3-[-10, -20] 4-[-20, -10]
#3 resolution 1-1 2-<1 3->1 4-> mixed
#4 returns_var 1-NULL 2-'dat'
#5 lat_reorder/Sort() 1-No 2-Yes,decreasing = F 3-Yes,decreasing = T
#6 lon_reorder/CircularSort() 1-No 2-Yes,(0, 360) 3-Yes,(-180, 180)
#7 transform 1-NO 2-YES
#8 transform_crop 1-T 2-F 3-region
## mixed resolution indicates lower than 1 degree resolution for longitude and higer for latitude.
##############################################
#path_exp <- '/esarchive/exp/ecmwf/system5_m1/daily_mean/$var$_f6h/$var$_$sdate$.nc'
path_exp <- '/esarchive/exp/ncar/cesm-dple/monthly_mean/$var$/$var$_$sdate$.nc'
## Origin longitude in file: [0:358.75] step 1.25 degrees #288 values
## latitude: -90 o 90 {-90, -89.05759 ...} #192 values
##############################################
test_that("1-1-4-2-1-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- 10
lats.max <- 20
res <- Start(dat = list(list(path = path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(10.83770, 19.31937),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
TRUE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
10
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
# lon
expect_equal(
range((attr(res, 'Variables')$dat1$longitude)),
c(40, 45),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$longitude)[1] < (attr(res, 'Variables')$dat1$longitude)[2],
TRUE
)
expect_equal(
length(attr(res, 'Variables')$dat1$longitude),
5
)
expect_equal(
class(attr(res, 'Variables')$dat1$longitude),
'array'
)
})
##############################################
test_that("1-2-4-2-1-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- 20
lats.max <- 10
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(10.83770, 19.31937),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
FALSE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
10
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
test_that("1-3-4-2-1-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- -10
lats.max <- -20
res <- Start(dat = list(list(path = path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(-19.31937, -10.83770),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
FALSE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
10
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
test_that("1-4-4-2-1-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- -20
lats.max <- -10
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(-19.31937, -10.83770),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
TRUE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
10
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
test_that("2-1-4-2-1-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- 10
lats.max <- 20
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(c(lats.min:lats.max)),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(9.895288, 20.261780),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
TRUE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
11
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
# lon
expect_equal(
range((attr(res, 'Variables')$dat1$longitude)),
c(40, 45),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$longitude)[1] < (attr(res, 'Variables')$dat1$longitude)[2],
TRUE
)
expect_equal(
length(attr(res, 'Variables')$dat1$longitude),
5
)
expect_equal(
class(attr(res, 'Variables')$dat1$longitude),
'array'
)
})
##############################################
test_that("2-2-4-2-1-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- 20
lats.max <- 10
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(c(lats.min:lats.max)),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(9.895288, 20.261780),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
FALSE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
11
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
test_that("2-3-4-2-1-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- -10
lats.max <- -20
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(c(lats.min:lats.max)),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(-20.261780, -9.895288),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
FALSE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
11
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
test_that("2-4-4-2-1-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- -20
lats.max <- -10
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(c(lats.min:lats.max)),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(-20.261780, -9.895288),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
TRUE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
11
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
test_that("1-1-4-3-1-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- 10
lats.max <- 20
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = NULL,
longitude = NULL,
time = NULL),
retrieve = F)
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# lat
expect_equal(
range((attr(res, 'Variables')$common$latitude)),
c(10.83770, 19.31937),
tolerance = 0.0001
)
expect_equal(
attr(res, 'Variables')$dat1$latitude,
NULL
)
expect_equal(
(attr(res, 'Variables')$common$latitude)[1] < (attr(res, 'Variables')$common$latitude)[2],
TRUE
)
expect_equal(
class(attr(res, 'Variables')$common$latitude),
'array'
)
})
##############################################
test_that("2-1-4-3-1-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- 10
lats.max <- 20
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(c(lats.min:lats.max)),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = NULL,
longitude = NULL,
time = NULL),
retrieve = F)
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# lat
expect_equal(
range((attr(res, 'Variables')$common$latitude)),
c(9.895288, 20.261780),
tolerance = 0.0001
)
expect_equal(
attr(res, 'Variables')$dat1$latitude,
NULL
)
expect_equal(
(attr(res, 'Variables')$common$latitude)[1] < (attr(res, 'Variables')$common$latitude)[2],
TRUE
)
expect_equal(
class(attr(res, 'Variables')$common$latitude),
'array'
)
})
##############################################
##############################################
test_that("1-1-4-2-2-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- 10
lats.max <- 20
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
latitude_reorder = Sort(),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(10.83770, 19.31937),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
TRUE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
10
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
# lon
expect_equal(
range((attr(res, 'Variables')$dat1$longitude)),
c(40, 45),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$longitude)[1] < (attr(res, 'Variables')$dat1$longitude)[2],
TRUE
)
expect_equal(
length(attr(res, 'Variables')$dat1$longitude),
5
)
expect_equal(
class(attr(res, 'Variables')$dat1$longitude),
'array'
)
})
##############################################
test_that("1-2-4-2-2-1-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- 20
lats.max <- 10
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
latitude_reorder = Sort(),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(10.83770, 19.31937),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
TRUE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
10
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
test_that("1-1-4-2-2-3-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- 10
lats.max <- 20
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
latitude_reorder = Sort(decreasing = T),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(10.83770, 19.31937),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
FALSE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
10
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
test_that("2-1-4-2-2-3-1-x", {
lons.min <- 40
lons.max <- 45
lats.min <- 10
lats.max <- 20
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(c(lats.min:lats.max)),
latitude_reorder = Sort(decreasing = T),
longitude = values(list(lons.min, lons.max)),
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(9.895288, 20.261780),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
FALSE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
11
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
#1 selector type 1-values(list) 2-values(vector) 3-indices 4-'all' 5-mix
#2 selector range 1-[10, 20] 2-[20, 10] 3-[-10, -20] 4-[-20, -10]
#3 resolution 1-1 2-<1 3->1 4 -> mixed4 -> mixed4 -> mixed4 -> mixed
#4 returns_var 1-NULL 2-'dat'
#5 lat_reorder/Sort() 1-No 2-Yes,decreasing = F 3-Yes,decreasing = T
#6 lon_reorder/CircularSort() 1-No 2-Yes,(0, 360) 3-Yes,(-180, 180)
#7 transform 1-NO 2-YES
#8 transform_crop 1-T 2-F 3-region
##############################################
test_that("1-1-4-2-1-1-2-3", {
lons.min <- 40
lons.max <- 45
lats.min <- 10
lats.max <- 20
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
longitude = values(list(lons.min, lons.max)),
transform = CDORemapper,
transform_params = list(grid ='r360x181',
method = 'con',
crop = c(lons.min,lons.max,
lats.min,lats.max)),
transform_vars = c('longitude', 'latitude'),
transform_extra_cells = 2,
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(10, 20),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
TRUE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
11
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
test_that("1-1-4-2-3-1-2-3", {
lons.min <- 40
lons.max <- 45
lats.min <- 10
lats.max <- 20
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
latitude_reorder = Sort(decreasing = T),
longitude = values(list(lons.min, lons.max)),
transform = CDORemapper,
transform_params = list(grid ='r360x181',
method = 'con',
crop = c(lons.min,lons.max,
lats.min,lats.max)),
transform_vars = c('longitude', 'latitude'),
transform_extra_cells = 2,
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(10, 20),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
FALSE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
11
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
test_that("1-1-4-2-3-2-2-3", {
lons.min <- 40
lons.max <- 45
lats.min <- 10
lats.max <- 20
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
latitude_reorder = Sort(decreasing = T),
longitude = values(list(lons.min, lons.max)),
longitude_reorder = CircularSort(0, 360),
transform = CDORemapper,
transform_params = list(grid ='r360x181',
method = 'con',
crop = c(lons.min,lons.max,
lats.min,lats.max)),
transform_vars = c('longitude', 'latitude'),
transform_extra_cells = 2,
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(10, 20),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
FALSE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
11
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
test_that("1-1-4-2-3-1-2-1", {
lons.min <- 40
lons.max <- 45
lats.min <- 10
lats.max <- 20
res <- Start(dat = list(list(path=path_exp)),
var = 'psl',
member = 'all',
sdate = '20001101',
time = indices(3:4),
latitude = values(list(lats.min, lats.max)),
latitude_reorder = Sort(decreasing = T),
longitude = values(list(lons.min, lons.max)),
transform = CDORemapper,
transform_params = list(grid ='r360x181',
method = 'con',
crop = T),
transform_vars = c('longitude', 'latitude'),
transform_extra_cells = 2,
synonims = list(latitude=c('lat','latitude'),
longitude=c('lon','longitude'),
member=c('ensemble','realization')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
time = NULL),
retrieve = F)
# lat
expect_equal(
range((attr(res, 'Variables')$dat1$latitude)),
c(10, 20),
tolerance = 0.0001
)
expect_equal(
(attr(res, 'Variables')$dat1$latitude)[1] < (attr(res, 'Variables')$dat1$latitude)[2],
FALSE
)
expect_equal(
length(attr(res, 'Variables')$dat1$latitude),
11
)
expect_equal(
class(attr(res, 'Variables')$dat1$latitude),
'array'
)
})
##############################################
#test_that("1-3. Selector type: indices(list)", {
#
#})
##############################################
#test_that("1-4. Selector type: indices(vector)", {
#
#})
##############################################
#test_that("1-4. Selector type: indices(vector)", {
#
#})