Newer
Older
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Analogs.R, R/CST_Analogs.R
\title{Analogs based on large scale fields.}
Analogs(
expL,
obsL,
time_obsL,
time_expL = NULL,
expVar = NULL,
obsVar = NULL,
criteria = "Large_dist",
excludeTime = NULL,
lonVar = NULL,
latVar = NULL,
region = NULL,
nAnalogs = NULL,
AnalogsInfo = FALSE
)
Analogs(
expL,
obsL,
time_obsL,
time_expL = NULL,
expVar = NULL,
obsVar = NULL,
criteria = "Large_dist",
excludeTime = NULL,
lonVar = NULL,
latVar = NULL,
region = NULL,
nAnalogs = NULL,
AnalogsInfo = FALSE
)
\item{expL}{an array of N named dimensions containing the experimental field
on the large scale for which the analog is aimed. This field is used to in
all the criterias. If parameter 'expVar' is not provided, the function will
return the expL analog. The element 'data' in the 's2dv_cube' object must
have, at least, latitudinal and longitudinal dimensions. The object is expect
to be already subset for the desired large scale region.}
\item{obsL}{an array of N named dimensions containing the observational field
on the large scale. The element 'data' in the 's2dv_cube' object must have
the same latitudinal and longitudinal dimensions as parameter 'expL' and a
temporal dimension with the maximum number of available observations.}
\item{time_obsL}{a character string indicating the date of the observations
in the format "dd/mm/yyyy". Reference time to search for analogs.}
\item{time_expL}{a character string indicating the date of the experiment
in the format "dd/mm/yyyy". Time to find the analogs.}
\item{expVar}{an array of N named dimensions containing the experimental
field on the local scale, usually a different variable to the parameter
'expL'. If it is not NULL (by default, NULL), the returned field by this
function will be the analog of parameter 'expVar'.}
\item{obsVar}{an array of N named dimensions containing the field of the
same variable as the passed in parameter 'expVar' for the same region.}
\item{criteria}{a character string indicating the criteria to be used for the
selection of analogs:
\item{Large_dist} minimum Euclidean distance in the large scale pattern;
\item{Local_dist} minimum Euclidean distance in the large scale pattern
and minimum Euclidean distance in the local scale pattern; and
\item{Local_cor} minimum Euclidean distance in the large scale pattern,
minimum Euclidean distance in the local scale pattern and highest
correlation in the local variable to downscale.}}
\item{excludeTime}{a character string indicating the date of the observations
in the format "dd/mm/yyyy" to be excluded during the search of analogs, in a
forecast might be NULL, if is not a forecast can not be NULL.}
\item{lonVar}{a vector containing the longitude of parameter 'expVar'.}
\item{latVar}{a vector containing the latitude of parameter 'expVar'.}
\item{region}{a vector of length four indicating the minimum longitude,
the maximum longitude, the minimum latitude and the maximum latitude.}
\item{nAnalogs}{number of Analogs to be selected to apply the criterias
'Local_dist' or 'Local_cor'. This is not the necessary the number of analogs
that the user can get, but the number of events with minimum distance in
which perform the search of the best Analog. The default value for the
'Large_dist' criteria is 1, for 'Local_dist' and 'Local_cor' criterias must
be greater than 1 in order to match with the first criteria, if nAnalogs is
NULL for 'Local_dist' and 'Local_cor' the default value will be set at the
length of 'time_obsL'. If AnalogsInfo is FALSE the function returns just
the best analog.}
\item{AnalogsInfo}{TRUE to get a list with two elements: 1) the downscaled
field and 2) the AnalogsInfo which contains: a) the number of the best
analogs, b) the corresponding value of the metric used in the selected
criteria (distance values for Large_dist and Local_dist,correlation values
for Local_cor), c)dates of the analogs). The analogs are listed in decreasing
order, the first one is the best analog (i.e if the selected criteria is
Local_cor the best analog will be the one with highest correlation, while for
Large_dist criteria the best analog will be the day with minimum Euclidean
distance). Set to FALSE to get a single analog, the best analog, for instance
for downscaling.}
AnalogsFields, dowscaled values of the best analogs for the criteria
selected. If AnalogsInfo is set to TRUE the function also returns a
list with the dowsncaled field and the Analogs Information.
AnalogsFields, dowscaled values of the best analogs for the criteria
selected. If AnalogsInfo is set to TRUE the function also returns a
list with the dowsncaled field and the Analogs Information.
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
This function perform a downscaling using Analogs. To compute
the analogs, the function search for days with similar large scale conditions
to downscaled fields in the local scale. The large scale and the local scale
regions are defined by the user. The large scale is usually given by
atmospheric circulation as sea level pressure or geopotential height (Yiou
et al, 2013) but the function gives the possibility to use another field. The
local scale will be usually given by precipitation or temperature fields, but
might be another variable.
The analogs function will find the best analogs based in three criterias:
(1) Minimum Euclidean distance in the large scale pattern (i.e. SLP)
(2) Minimum Euclidean distance in the large scale pattern (i.e. SLP)
and minimum Euclidean distance in the local scale pattern (i.e. SLP).
(3) Minimum Euclidean distance in the large scale pattern (i.e. SLP),
minimum distance in the local scale pattern (i.e. SLP) and highest
correlation in the local variable to downscale (i.e Precipitation).
The search of analogs must be done in the longest dataset posible. This is
important since it is necessary to have a good representation of the
possible states of the field in the past, and therefore, to get better
analogs. Once the search of the analogs is complete, and in order to used the
three criterias the user can select a number of analogs , using parameter
'nAnalogs' to restrict
the selection of the best analogs in a short number of posibilities, the best
ones. This function has not constrains of specific regions, variables to
downscale, or data to be used (seasonal forecast data, climate projections
data, reanalyses data). The regrid into a finner scale is done interpolating
with CST_Load. Then, this interpolation is corrected selecting the analogs in
the large and local scale in based of the observations. The function is an
adapted version of the method of Yiou et al 2013.
This function perform a downscaling using Analogs. To compute
the analogs, the function search for days with similar large scale conditions
to downscaled fields in the local scale. The large scale and the local scale
regions are defined by the user. The large scale is usually given by
atmospheric circulation as sea level pressure or geopotential height (Yiou
et al, 2013) but the function gives the possibility to use another field. The
local scale will be usually given by precipitation or temperature fields, but
might be another variable.
The analogs function will find the best analogs based in three criterias:
(1) Minimum Euclidean distance in the large scale pattern (i.e. SLP)
(2) Minimum Euclidean distance in the large scale pattern (i.e. SLP)
and minimum Euclidean distance in the local scale pattern (i.e. SLP).
(3) Minimum Euclidean distance in the large scale pattern (i.e. SLP),
minimum distance in the local scale pattern (i.e. SLP) and highest
correlation in the local variable to downscale (i.e Precipitation).
The search of analogs must be done in the longest dataset posible. This is
important since it is necessary to have a good representation of the
possible states of the field in the past, and therefore, to get better
analogs. Once the search of the analogs is complete, and in order to used the
three criterias the user can select a number of analogs , using parameter
the selection of the best analogs in a short number of posibilities, the best
ones. This function has not constrains of specific regions, variables to
downscale, or data to be used (seasonal forecast data, climate projections
data, reanalyses data). The regrid into a finner scale is done interpolating
with CST_Load. Then, this interpolation is corrected selecting the analogs in
the large and local scale in based of the observations. The function is an
adapted version of the method of Yiou et al 2013.
# Example 1:Downscaling using criteria 'Large_dist' and a single variable:
# The best analog is found using a single variable (i.e. Sea level pressure,
# SLP). The downscaling will be done in the same variable used to study the
# minimal distance (i.e. SLP). obsVar and expVar NULLS or equal to obsL and
# expL respectively region, lonVar and latVar not necessary here,
# excludeTime=NULL
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*1.2)
dim(obsSLP) <- c(time = 10,lat = 4, lon = 5)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
downscale_field <- Analogs(expL=expSLP, obsL=obsSLP, time_obsL=time_obsSLP,
time_expL = "01-01-1994")
# Example 2: Downscaling using criteria 'Large_dist' and 2 variables:
# The best analog is found using 2 variables (i.e. Sea Level Pressure, SLP
# and precipitation, pr): one variable (i.e. sea level pressure, expL) to
# find the best analog day (defined in criteria 'Large_dist' as the day, in
# obsL, with the minimum Euclidean distance to the day of interest in expL)
# The second variable will be the variable to donwscale (i.e. precipitation,
# obsVar). Parameter obsVar must be different to obsL.The downscaled
# precipitation will be the precipitation that belongs to the best analog day
# in SLP. Region not needed here since will be the same for both variables.
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(time = 10,lat = 4, lon = 5)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
downscale_field <- Analogs(expL=expSLP, obsL=obsSLP,
time_obsL=time_obsSLP,time_expL = "01-01-1994")
# Example 3:List of best Analogs using criteria 'Large_dist' and a single
# variable: same as Example 1 but getting a list of best analogs (AnalogsInfo
# =TRUE) with the corresponding downscaled values, instead of only 1 single
# donwscaled value instead of 1 single downscaled value. Imposing nAnalogs
# (number of analogs to do the search of the best Analogs). obsVar and expVar
# NULL or equal to obsL and expL,respectively.
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:1980),expSLP*1.5)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 100)
time_obsSLP <- paste(rep("01", 100), rep("01", 100), 1920 : 2019, sep = "-")
downscale_field<- Analogs(expL=expSLP, obsL=obsSLP, time_obsSLP,
nAnalogs=5,time_expL = "01-01-2003",
str(downscale_field)
# Example 4:List of best Analogs using criteria 'Large_dist' and 2 variables:
# same as example 2 but getting a list of best analogs (AnalogsInfo =TRUE)
# with the values instead of only a single downscaled value. Imposing
# nAnalogs (number of analogs to do the search of the best Analogs). obsVar
# and expVar must be different to obsL and expL.
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
downscale_field <- Analogs(expL=expSLP, obsL=obsSLP,
time_obsL=time_obsSLP,nAnalogs=5,
time_expL = "01-10-2003",
AnalogsInfo=TRUE)
str(downscale_field)
# Example 5: Downscaling using criteria 'Local_dist' and 2 variables:
# The best analog is found using 2 variables (i.e. Sea Level Pressure,
# SLP and precipitation, pr). Parameter obsVar must be different to obsL.The
# downscaled precipitation will be the precipitation that belongs to the best
# analog day in SLP. lonVar, latVar and Region must be given here to select
# the local scale
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
# analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
Local_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obs.pr,
criteria="Local_dist",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),region=region,
time_expL = "01-10-2000",
nAnalogs = 10, AnalogsInfo=TRUE)
# Example 6: list of best analogs using criteria 'Local_dist' and 2
# variables:
# The best analog is found using 2 variables. Parameter obsVar must be
# different to obsL in this case.The downscaled precipitation will be the
# precipitation that belongs to the best analog day in SLP. lonVar, latVar
# and Region needed. AnalogsInfo=TRUE
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
# analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
Local_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
criteria="Local_dist",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),region=region,
time_expL = "01-10-2000",
nAnalogs = 5, AnalogsInfo = TRUE)
# Example 7: Downscaling using Local_dist criteria
# without parameters obsVar and expVar. return list =FALSE
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
# analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
Local_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
criteria="Local_dist",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),region=region,
time_expL = "01-10-2000",
nAnalogs = 10, AnalogsInfo = TRUE)
str(Local_scale)
# Example 8: Downscaling using criteria 'Local_cor' and 2 variables:
# The best analog is found using 2 variables. Parameter obsVar and expVar
# are necessary and must be different to obsL and expL, respectively.
# The downscaled precipitation will be the precipitation that belongs to
# the best analog day in SLP large and local scales, and to the day with
# the higher correlation in precipitation. AnalogsInfo=FALSE. two options
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
exp.pr <- c(rnorm(1:20)*0.001)
dim(exp.pr)=dim(expSLP)
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
# analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
Local_scalecor <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obs.pr,expVar=exp.pr,
criteria="Local_cor",lonVar=seq(-1,5,1.5),
time_expL = "01-10-2000",
latVar=seq(30,35,1.5),nAnalogs=8,region=region,
AnalogsInfo = FALSE)
str(Local_scalecor)
# same but without imposing nAnalogs,so nAnalogs will be set by default as 10
Local_scalecor <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obs.pr,expVar=exp.pr,
criteria="Local_cor",lonVar=seq(-1,5,1.5),
time_expL = "01-10-2000",
latVar=seq(30,35,1.5),region=region,
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
Large_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
criteria="Large_dist", time_expL = "01-10-2000",
nAnalogs = 7, AnalogsInfo = TRUE)
# analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
obsL=obsSLP, time_obsL=time_obsSLP,
time_expL = "01-10-2000",
latVar=seq(30,35,1.5),nAnalogs=7,region=region,
# analogs of local scale using criteria 3
Local_scalecor <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obsSLP,expVar=expSLP,
time_expL = "01-10-2000",
criteria="Local_cor",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),nAnalogs=7,region=region,
# Example 10: Downscaling in the three criteria Large_dist, Local_dist, and
# Local_cor return list FALSE, different variable
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
exp.pr <- c(rnorm(1:20)*0.001)
dim(exp.pr)=dim(expSLP)
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
Large_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
criteria="Large_dist",time_expL = "01-10-2000",
nAnalogs = 7, AnalogsInfo=TRUE)
# # analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
Local_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obs.pr,time_expL = "01-10-2000",
latVar=seq(30,35,1.5),nAnalogs=7,region=region,
AnalogsInfo = TRUE)
# # analogs of local scale using criteria 3
Local_scalecor <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obs.pr,expVar=exp.pr,
time_expL = "01-10-2000",
criteria="Local_cor",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),nAnalogs=7,region=region,
AnalogsInfo = TRUE)
453
454
455
456
457
458
459
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
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
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
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
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
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
# Example 1:Downscaling using criteria 'Large_dist' and a single variable:
# The best analog is found using a single variable (i.e. Sea level pressure,
# SLP). The downscaling will be done in the same variable used to study the
# minimal distance (i.e. SLP). obsVar and expVar NULLS or equal to obsL and
# expL respectively region, lonVar and latVar not necessary here,
# excludeTime=NULL
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*1.2)
dim(obsSLP) <- c(time = 10,lat = 4, lon = 5)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
downscale_field <- Analogs(expL=expSLP, obsL=obsSLP, time_obsL=time_obsSLP,
time_expL = "01-01-1994")
str(downscale_field)
# Example 2: Downscaling using criteria 'Large_dist' and 2 variables:
# The best analog is found using 2 variables (i.e. Sea Level Pressure, SLP
# and precipitation, pr): one variable (i.e. sea level pressure, expL) to
# find the best analog day (defined in criteria 'Large_dist' as the day, in
# obsL, with the minimum Euclidean distance to the day of interest in expL)
# The second variable will be the variable to donwscale (i.e. precipitation,
# obsVar). Parameter obsVar must be different to obsL.The downscaled
# precipitation will be the precipitation that belongs to the best analog day
# in SLP. Region not needed here since will be the same for both variables.
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(time = 10,lat = 4, lon = 5)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
downscale_field <- Analogs(expL=expSLP, obsL=obsSLP,
obsVar=obs.pr,
time_obsL=time_obsSLP,time_expL = "01-01-1994")
str(downscale_field)
# Example 3:List of best Analogs using criteria 'Large_dist' and a single
# variable: same as Example 1 but getting a list of best analogs (AnalogsInfo
# =TRUE) with the corresponding downscaled values, instead of only 1 single
# donwscaled value instead of 1 single downscaled value. Imposing nAnalogs
# (number of analogs to do the search of the best Analogs). obsVar and expVar
# NULL or equal to obsL and expL,respectively.
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:1980),expSLP*1.5)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 100)
time_obsSLP <- paste(rep("01", 100), rep("01", 100), 1920 : 2019, sep = "-")
downscale_field<- Analogs(expL=expSLP, obsL=obsSLP, time_obsSLP,
nAnalogs=5,time_expL = "01-01-2003",
AnalogsInfo=TRUE, excludeTime= "01-01-2003")
str(downscale_field)
# Example 4:List of best Analogs using criteria 'Large_dist' and 2 variables:
# same as example 2 but getting a list of best analogs (AnalogsInfo =TRUE)
# with the values instead of only a single downscaled value. Imposing
# nAnalogs (number of analogs to do the search of the best Analogs). obsVar
# and expVar must be different to obsL and expL.
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
downscale_field <- Analogs(expL=expSLP, obsL=obsSLP,
obsVar=obs.pr,
time_obsL=time_obsSLP,nAnalogs=5,
time_expL = "01-10-2003",
AnalogsInfo=TRUE)
str(downscale_field)
# Example 5: Downscaling using criteria 'Local_dist' and 2 variables:
# The best analog is found using 2 variables (i.e. Sea Level Pressure,
# SLP and precipitation, pr). Parameter obsVar must be different to obsL.The
# downscaled precipitation will be the precipitation that belongs to the best
# analog day in SLP. lonVar, latVar and Region must be given here to select
# the local scale
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
# analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
Local_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obs.pr,
criteria="Local_dist",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),region=region,
time_expL = "01-10-2000",
nAnalogs = 10, AnalogsInfo=TRUE)
str(Local_scale)
# Example 6: list of best analogs using criteria 'Local_dist' and 2
# variables:
# The best analog is found using 2 variables. Parameter obsVar must be
# different to obsL in this case.The downscaled precipitation will be the
# precipitation that belongs to the best analog day in SLP. lonVar, latVar
# and Region needed. AnalogsInfo=TRUE
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
# analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
Local_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
criteria="Local_dist",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),region=region,
time_expL = "01-10-2000",
nAnalogs = 5, AnalogsInfo = TRUE)
str(Local_scale)
# Example 7: Downscaling using Local_dist criteria
# without parameters obsVar and expVar. return list =FALSE
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
# analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
Local_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
criteria="Local_dist",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),region=region,
time_expL = "01-10-2000",
nAnalogs = 10, AnalogsInfo = TRUE)
str(Local_scale)
# Example 8: Downscaling using criteria 'Local_cor' and 2 variables:
# The best analog is found using 2 variables. Parameter obsVar and expVar
# are necessary and must be different to obsL and expL, respectively.
# The downscaled precipitation will be the precipitation that belongs to
# the best analog day in SLP large and local scales, and to the day with
# the higher correlation in precipitation. AnalogsInfo=FALSE. two options
# for nAnalogs
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
exp.pr <- c(rnorm(1:20)*0.001)
dim(exp.pr)=dim(expSLP)
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
# analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
Local_scalecor <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obs.pr,expVar=exp.pr,
criteria="Local_cor",lonVar=seq(-1,5,1.5),
time_expL = "01-10-2000",
latVar=seq(30,35,1.5),nAnalogs=8,region=region,
AnalogsInfo = FALSE)
str(Local_scalecor)
# same but without imposing nAnalogs,so nAnalogs will be set by default as 10
Local_scalecor <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obs.pr,expVar=exp.pr,
criteria="Local_cor",lonVar=seq(-1,5,1.5),
time_expL = "01-10-2000",
latVar=seq(30,35,1.5),region=region,
AnalogsInfo = TRUE)
Local_scalecor$AnalogsInfo
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
# analogs of large scale using criteria 1
Large_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
criteria="Large_dist", time_expL = "01-10-2000",
nAnalogs = 7, AnalogsInfo = TRUE)
str(Large_scale)
Large_scale$AnalogsInfo
# analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
Local_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
time_expL = "01-10-2000",
criteria="Local_dist",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),nAnalogs=7,region=region,
AnalogsInfo = TRUE)
str(Local_scale)
Local_scale$AnalogsInfo
# analogs of local scale using criteria 3
Local_scalecor <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obsSLP,expVar=expSLP,
time_expL = "01-10-2000",
criteria="Local_cor",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),nAnalogs=7,region=region,
AnalogsInfo = TRUE)
str(Local_scalecor)
Local_scalecor$AnalogsInfo
# Example 10: Downscaling in the three criteria Large_dist, Local_dist, and
# Local_cor return list FALSE, different variable
expSLP <- rnorm(1:20)
dim(expSLP) <- c(lat = 4, lon = 5)
obsSLP <- c(rnorm(1:180),expSLP*2)
dim(obsSLP) <- c(lat = 4, lon = 5, time = 10)
time_obsSLP <- paste(rep("01", 10), rep("01", 10), 1994 : 2003, sep = "-")
exp.pr <- c(rnorm(1:20)*0.001)
dim(exp.pr)=dim(expSLP)
obs.pr <- c(rnorm(1:200)*0.001)
dim(obs.pr)=dim(obsSLP)
Large_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
criteria="Large_dist",time_expL = "01-10-2000",
nAnalogs = 7, AnalogsInfo=TRUE)
str(Large_scale)
Large_scale$AnalogsInfo
# # analogs of local scale using criteria 2
lonmin=-1
lonmax=2
latmin=30
latmax=33
region=c(lonmin,lonmax,latmin,latmax)
Local_scale <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obs.pr,time_expL = "01-10-2000",
criteria="Local_dist",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),nAnalogs=7,region=region,
AnalogsInfo = TRUE)
str(Local_scale)
Local_scale$AnalogsInfo
# # analogs of local scale using criteria 3
Local_scalecor <- Analogs(expL=expSLP,
obsL=obsSLP, time_obsL=time_obsSLP,
obsVar=obs.pr,expVar=exp.pr,
time_expL = "01-10-2000",
criteria="Local_cor",lonVar=seq(-1,5,1.5),
latVar=seq(30,35,1.5),nAnalogs=7,region=region,
AnalogsInfo = TRUE)
str(Local_scalecor)
Local_scalecor$AnalogsInfo
Yiou, P., T. Salameh, P. Drobinski, L. Menut, R. Vautard,
and M. Vrac, 2013 : Ensemble reconstruction of the atmospheric column
from surface pressure using analogues. Clim. Dyn., 41, 1419-1437.
\email{pascal.yiou@lsce.ipsl.fr}
Yiou, P., T. Salameh, P. Drobinski, L. Menut, R. Vautard,
and M. Vrac, 2013 : Ensemble reconstruction of the atmospheric column
from surface pressure using analogues. Clim. Dyn., 41, 1419-1437.
\email{pascal.yiou@lsce.ipsl.fr}
}
\author{
M. Carmen Alvarez-Castro, \email{carmen.alvarez-castro@cmcc.it}
Maria M. Chaves-Montero, \email{mariadm.chaves@cmcc.it }
Nuria Perez-Zanon \email{nuria.perez@bsc.es}
M. Carmen Alvarez-Castro, \email{carmen.alvarez-castro@cmcc.it}
Maria M. Chaves-Montero, \email{mariadm.chaves@cmcc.it }
Nuria Perez-Zanon \email{nuria.perez@bsc.es}
}