GetWeightedRangeShifts

This application will find the weighted mean coordinates of all patches within the specified range margin, for each time step of the simulation, and calculates the change in position of the mean from the previous time step. That is, the application tracks the movement of the weighted centroids of the range margins, where the weighting factors are the abundance of each patch within the margins.

Arguments

There are five mandatory arguments and four optional arguments to this application. Optional arguments are listed between brackets below:

MPFile Start_Year X | Y Threshold Delimiter [burn-in patch_abundance_threshold smoothing_method (sma | exp) window_size]

MPFile is the metapop file to process
Start_Year is the first year of the simulation. Each subsequent time-step is assumed to be one year after this
X | Y if X then the metapopulation movement will be tracked along the East-West axis, if Y the movement will be tracked along the North-South axis
Threshold is the proportion of the metapopulation that will be taken as the range margins. For example, if 0.1 is specified, then the most northerly and southerly ten percent of the population will be taken as the range margin.
Delimiter is the character used to delimit the fields in the outputs
burn-in is the number of years to ignore at the start of the simulation, if a "burn-in" period is being used
patch_abundance_threshold is the minimum abundance threshold, any patch with an abundance less than this will not be included in the calculations
smoothing_method is the method to use to smooth the time-series output by the application. Options are sma for simple moving average and exp for exponential smoothing
window_size is the number of years to include in the smoothing method. Although exponential smoothing doesn't strictly use a smoothing window, the application does use the window size to calculate the weighting factor

Outputs

The outputs of the application are the number of patches loaded, the number of years the simulation was run for, the initial coordinates of the centroid, and a time-series of the movements of the centroid per year of the simulation.

Examples

The command below measures the north-south range margin shiftsm using the most northerly and southerly ten percent of the metapopulation as the margins.

getweightedrangeshifts example.mp 2000 Y 0.1 ,

This yields the following output

Num patches loaded,358
Resolution(km),1
Total years,20
,North,,South
Initial Coords,9.5025,4.99661,,10.0423,27.1155
Year,X,Y,Year,X,Y
2000,0,0,2000,0,0
2001,0.143732,0.11979,2001,0.0106858,0.0202417
2002,0.194308,0.425885,2002,-0.150163,7.6902e-05
2003,0.120947,0.708188,2003,-0.167982,-0.0337407
2004,0.12065,1.13678,2004,-0.106825,-0.00240547
2005,0.0912337,1.36507,2005,-0.23427,0.0243571
2006,-0.125843,1.85485,2006,-0.153332,0.0415175
2007,-0.370029,2.19056,2007,-0.217938,0.0519141
2008,-0.424451,2.44106,2008,0.40026,0.142666
2009,0.127683,2.64672,2009,0.333234,0.234751
2010,0.464732,2.85685,2010,-0.00705406,0.440539
2011,0.764287,3.0617,2011,0.223917,0.806018
2012,0.884742,3.28737,2012,-0.00760644,1.35788
2013,1.6557,3.50538,2013,-0.274764,1.76576
2014,2.1062,3.61476,2014,-1.0521,2.1718
2015,2.12662,3.63528,2015,-2.18355,2.85063
2016,2.04879,3.66431,2016,-2.81944,3.26952
2017,1.99314,3.68496,2017,-2.69471,3.63232
2018,1.92251,3.69039,2018,-2.81908,3.86416
2019,1.95805,3.70066,2019,-2.74175,3.83189

Applying a three-year burn-in with the following command:

getweightedrangeshifts example.mp 2000 Y 0.1 , 3

Yields the following output:

Num patches loaded,358
Resolution(km),1
Total years,20
Burn-in years,3
,North,,South
Initial Coords,9.38155,4.28842,,10.2103,27.1493
Year,X,Y,Year,X,Y
2003,0,0,2003,0,0
2004,-0.000297579,0.428595,2004,0.0611563,0.0313352
2005,-0.0297136,0.656883,2005,-0.0662878,0.0580978
2006,-0.24679,1.14666,2006,0.0146498,0.0752582
2007,-0.490976,1.48237,2007,-0.0499565,0.0856548
2008,-0.545398,1.73287,2008,0.568242,0.176407
2009,0.00673604,1.93853,2009,0.501216,0.268492
2010,0.343784,2.14866,2010,0.160928,0.47428
2011,0.64334,2.35352,2011,0.391899,0.839758
2012,0.763794,2.57918,2012,0.160375,1.39162
2013,1.53475,2.7972,2013,-0.106782,1.7995
2014,1.98525,2.90657,2014,-0.884121,2.20555
2015,2.00567,2.92709,2015,-2.01557,2.88437
2016,1.92784,2.95612,2016,-2.65146,3.30326
2017,1.87219,2.97677,2017,-2.52673,3.66606
2018,1.80156,2.9822,2018,-2.6511,3.8979
2019,1.8371,2.99247,2019,-2.57377,3.86563

Patches with abundances less the five are filtered out as follows:

getweightedrangeshifts example.mp 2000 Y 0.1 , 3 5

which gives us:

Num patches loaded,358
Patch size threshold,5
Num patches after cleaning,203
Resolution(km),1
Total years,20
Burn-in years,3
,North,,South
Initial Coords,9.26576,4.1985,,10.0736,27.0754
Year,X,Y,Year,X,Y
2003,0,0,2003,0,0
2004,-0.121915,0.381087,2004,-0.00366085,-0.000159097
2005,-0.146632,0.603554,2005,-0.208181,0.00955129
2006,-0.389272,1.10884,2006,-0.0876598,0.00446977
2007,-0.658249,1.42245,2007,-0.219742,0.00905419
2008,-0.625596,1.65564,2008,0.413886,0.101646
2009,-0.102547,1.85101,2009,0.367744,0.192938
2010,0.231313,2.06057,2010,0.0234502,0.398549
2011,0.531462,2.26574,2011,0.24584,0.766588
2012,0.655531,2.49246,2012,0.0367999,1.37706
2013,1.51827,2.72895,2013,-0.774774,2.06613
2014,1.85716,2.82031,2014,-1.46883,2.44799
2015,1.88915,2.83743,2015,-2.1511,2.80955
2016,1.81025,2.86685,2016,-2.81113,3.27202
2017,1.75311,2.888,2017,-2.65665,3.641
2018,1.66966,2.89306,2018,-2.7511,3.79866
2019,1.7019,2.90143,2019,-2.68439,3.76537


Finally, applying exponential smoothing with a window size of three:

getweightedrangeshifts example.mp 2000 Y 0.1 , 3 5 exp 3

Num patches loaded,358
Patch size threshold,5
Num patches after cleaning,203
Resolution(km),1
Total years,20
Burn-in years,3
Exponential smoothing window,3
,North,,South
Initial Coords,9.26576,4.1985,,10.0736,27.0754
Year,X,Y,Year,X,Y
2003,0,0,2003,0,0
2004,-0.0609574,0.190544,2004,-0.00183042,-7.95484e-05
2005,-0.103795,0.397049,2005,-0.105006,0.00473587
2006,-0.246533,0.752944,2006,-0.0963327,0.00460282
2007,-0.452391,1.0877,2007,-0.158037,0.00682851
2008,-0.538993,1.37167,2008,0.127925,0.0542371
2009,-0.32077,1.61134,2009,0.247834,0.123587
2010,-0.0447285,1.83595,2010,0.135642,0.261068
2011,0.243367,2.05085,2011,0.190741,0.513828
2012,0.449449,2.27166,2012,0.113771,0.945443
2013,0.98386,2.5003,2013,-0.330502,1.50579
2014,1.42051,2.66031,2014,-0.899666,1.97689
2015,1.65483,2.74887,2015,-1.52538,2.39322
2016,1.73254,2.80786,2016,-2.16826,2.83262
2017,1.74282,2.84793,2017,-2.41246,3.23681
2018,1.70624,2.8705,2018,-2.58178,3.51773
2019,1.70407,2.88596,2019,-2.63308,3.64155




Back to RAMAS Metapop Tools main page.


Tweet
Maintained by Michael J. Watts