GetMeans

This application will find the mean coordinates of all patches with abundance greater than zero, 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 unweighted centroid of the metapopulation.

Arguments

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

MPFile Start_Year X | Y 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
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 following command:

getmeans example.mp 2000 Y ,

Yields this output:

Num patches loaded,358
Resolution(km),1
Total years,20
Initial Coords,11.0044,14.3442,
Year,X,Y
2000,0,0
2001,0.312078,0.360586
2002,0.173952,0.69154
2003,0.0978526,0.858413
2004,0.102206,1.2767
2005,-0.0325821,0.996794
2006,0.0969266,1.39393
2007,0.187161,1.77742
2008,0.221595,1.96101
2009,0.179989,1.75312
2010,0.170756,2.01624
2011,0.0820157,2.10639
2012,-0.0609507,2.40753
2013,0.0192803,2.42139
2014,-0.11228,2.59556
2015,-0.346676,3.49187
2016,-0.334342,3.7856
2017,-0.246703,3.85251
2018,-0.103462,5.05542
2019,-0.245794,4.31252

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

getmeans example.mp 2000 Y , 3

outputs:

Num patches loaded,358
Resolution(km),1
Total years,20
Burn-in years,3
Initial Coords,10.9066,13.4858,
Year,X,Y
2003,0,0
2004,0.00435323,0.418286
2005,-0.130435,0.13838
2006,-0.000926009,0.535521
2007,0.0893087,0.919009
2008,0.123742,1.10259
2009,0.082136,0.894704
2010,0.0729036,1.15783
2011,-0.0158368,1.24798
2012,-0.158803,1.54911
2013,-0.0785723,1.56298
2014,-0.210133,1.73714
2015,-0.444529,2.63346
2016,-0.432195,2.92719
2017,-0.344556,2.9941
2018,-0.201315,4.197
2019,-0.343646,3.45411

Patches with abundance less than five are filtered out as follows:

getmeans example.mp 2000 Y , 3 5

Which gives the following output:

Num patches loaded,358
Patch size threshold,5
Num patches after cleaning,203
Resolution(km),1
Total years,20
Burn-in years,3
Initial Coords,10.9315,12.7384,
Year,X,Y
2003,0,0
2004,0.0667914,0.079875
2005,-0.0545472,-0.235284
2006,0.0867109,0.0978416
2007,0.105696,0.299834
2008,0.0259186,0.496805
2009,0.0618057,0.122617
2010,0.0812595,0.427285
2011,-0.0167405,0.342471
2012,-0.24406,0.683458
2013,-0.14762,1.03379
2014,-0.335945,1.15786
2015,-0.413772,1.74052
2016,-0.344394,2.06647
2017,-0.443015,1.92682
2018,-0.489119,2.17663
2019,-0.489119,2.17663

Note that the output now includes the patch size threshold, and the number of retained patches.

Finally, the output time-series is smoothed using exponential smoothing, with the following command:

getmeans example.mp 2000 Y , 3  5 exp 3

Which gives the following output:

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
Initial Coords,10.9315,12.7384,
Year,X,Y
2003,0,0
2004,0.0333957,0.0399375
2005,-0.0105758,-0.0976734
2006,0.0380676,8.41388e-05
2007,0.0718816,0.149959
2008,0.0489001,0.323382
2009,0.0553529,0.223
2010,0.0683062,0.325143
2011,0.0257829,0.333807
2012,-0.109138,0.508633
2013,-0.128379,0.771211
2014,-0.232162,0.964534
2015,-0.322967,1.35253
2016,-0.33368,1.7095
2017,-0.388347,1.81816
2018,-0.438733,1.99739
2019,-0.463926,2.08701




Back to RAMAS Metapop Tools main page.


Maintained by Dr Michael J. Watts