$\begin{split}(\alpha_{i}-1)\gamma_{i}-2\log\left[\alpha^{N_{\bm{\psi}}/2}\left|1+\frac{\gamma_{i}}{\alpha^{1/2}_{i}}\frac{\partial\alpha^{1/2}_{i}}{\partial\gamma_{i}}\right|\right]&=w_{target}-c_{i}.\end{split}$
(A.8)

This equation is equivalent to

$\Gamma\left(\frac{N_{x}}{2},\frac{\alpha_{i}\gamma_{i}}{2}\right)=e^{-c_{i}^{\star}/2}\Gamma\left(\frac{N_{x}}{2},\frac{\gamma_{i}}{2}\right),$
(A.9)

which can be solved numerically for $\alpha_{i}$ by, e.g., the Newton method,
as illustrated by Skauvold et al. [30]. Here, we use that

$c_{i}^{\star}=w_{target}-c_{i}=\max_{j=1,...,N_{e}}\\{c_{j}\\}-c_{i},$ (A.10)

and $\Gamma(s,x)=\int_{0}^{x}t^{s-1}e^{-t}\mathrm{d}t$ is the incomplete lower
gamma function. Whenever the state space $N_{\bm{\psi}}$ is large, however,
(A.9) becomes harder to solve as the gamma functions become prone to overflow.
In this high-dimensional limit, it is possible to solve (A.8) analytically in
terms of the Lambert W function, as showed by Zhu et al. [28], as

$\alpha_{i}=-\frac{N_{\bm{\psi}}}{\gamma_{i}}W_{0}\left[-\frac{\gamma_{i}}{N_{\bm{\psi}}}e^{-\gamma_{i}/N_{\bm{\psi}}}e^{-c_{i}^{\star}/N_{\bm{\psi}}}\right].$
(A.11)

As pointed out by Skauvold et al [30], only solutions $\alpha_{i}<1$ should be
accepted, meaning that only the zero branch for the Lambert W function is
considered.

Two weaknesses of the scheme above can be identified. Firstly, for low-
dimensional systems it can be shown that the posterior variance is always
underestimated. The other weakness occurs for high-dimensional systems. Since
all particles have to reach the same target weight, and that target weight has
to be chosen as the weight of the weakest particle, the more particles we use
the worse the weakest particle will be, so the further away all particles are
pushed from the high likelihood values. So, in high dimensions, although the
scheme is useful for small ensemble sizes, it degenerates at larger ensemble
sizes.

To overcome the above-mentioned challenges, a revised two-stage IEWPF scheme
has been proposed [30], which explores the complete proposal density and does
not underestimate the posterior variance. The new update equation is

$\bm{\psi}_{i}^{n}=\bm{\psi}_{i}^{n,a}+\beta^{1/2}P^{1/2}\nu_{i}+\alpha_{i}^{1/2}P^{1/2}\xi_{i},$
(A.12)

in which $\nu_{i}$ is a second random vector $\nu_{i}\sim N(0,I)$, and $\beta$
is a covariance scaling parameter common to all particles. Using the same
assumptions as for the one-stage method, (A.3) can now be written as

$\log\left(w_{i}^{n}\right)=(\alpha_{i}-1)\gamma_{i}+2\beta^{1/2}\alpha_{i}^{1/2}\xi_{i}^{T}\nu_{i}+(\beta-1)\zeta_{i}-2\log\left[\alpha_{i}^{N_{\bm{\psi}}/2}\left|1+\frac{\gamma_{i}}{\alpha^{1/2}_{i}}\frac{\partial\alpha^{1/2}_{i}}{\partial\gamma_{i}}\right|\right]+c_{i},$
(A.13)

in which $c_{i}$ is according to (A.5), and $\zeta_{i}=\nu_{i}^{T}\nu_{i}$. To
solve (A.13), $\nu_{i}$ is constructed to be perpendicular to $\xi_{i}$,
making the cross term between the two random vectors disappear. In the case of
large $N_{\bm{\psi}}$, and by defining

$c_{i}^{\star}=w_{target}-c_{i}-(\beta-1)\zeta_{i},$ (A.14)

(A.13) becomes similar to (A.8), with solution according to (A.11). We require
that $c_{i}^{\star}\geq 0$, which is equivalent to

$\beta\leq\frac{w_{target}-c_{i}}{\zeta_{i}}+1.$ (A.15)

This equation shows that the introduction of $\beta$ allows us to choose a
different target weight. By choosing the target weight to be
$w_{target}=\overline{c_{i}}$, the mean of $c_{i}$ across the ensemble,
$\beta$ can be set to the minimum value of the right-hand-side of (A.15),

$\beta=\min_{i=1,...,N_{e}}\left\\{\frac{\overline{c_{i}}-c_{i}}{\zeta_{i}}+1\right\\}.$
(A.16)

Since $\overline{c}-c_{i}\approx N_{y}\pm\sqrt{2N_{y}}$ and $\zeta_{i}\approx
N_{\bm{\psi}}\pm\sqrt{2N_{\bm{\psi}}}$, the parameter $\beta^{1/2}$ should
remain real as long as $N_{\bm{\psi}}>>N_{y}$, which holds for our high-
dimensional application.

Choosing the target weight equal to the mean of $c_{i}$, is equivalent to
choosing it equal to the mean of the optimal proposal weights. An advantage
with this choice is that the target weight will not vary much when $N_{e}$
increases. This is contrary to the one-stage scheme, in which the target
weight is equal to $\max_{i=1,..,N_{e}}\\{c_{i}\\}$, which becomes larger if
$N_{e}$ increases. In other words, the one-stage scheme pushes the particles
further and further away from the high-probability regions of the posterior.
Because of its choice of $w_{target}$, the two-stage scheme does not have this
problem, and is the method of choice in this paper.

## References

  * [1] K.-F. Dagestad, J. Röhrs, Ø. Breivik, and B. Ådlandsvik, “OpenDrift v1.0: a generic framework for trajectory modelling,” Geoscientific Model Development, vol. 11, no. 4, pp. 1405–1420, 2018.
  * [2] C. Snyder, T. Bengtsson, P. Bickel, and J. Anderson, “Obstacles to high-dimensional particle filtering,” Monthly Weather Review, vol. 136, no. 12, pp. 4629–4640, 2008.
  * [3] P. J. van Leeuwen, “Particle filtering in geophysical systems,” Monthly Weather Review, vol. 137, no. 12, pp. 4089–4114, 2009.
  * [4] C. Snyder, T. Bengtsson, and M. Morzfeld, “Performance bounds for particle filters using the optimal proposal,” Monthly Weather Review, vol. 143, no. 11, pp. 4750–4761, 2015.
  * [5] P. J. van Leeuwen, “Nonlinear data assimilation in geosciences: an extremely efficient particle filter,” Quarterly Journal of the Royal Meteorological Society, vol. 136, no. 653, pp. 1991–1999, 2010.
  * [6] J. Poterjoy, R. A. Sobash, and J. L. Anderson, “Convective-scale data assimilation for the weather research and forecasting model using the local particle filter,” Monthly Weather Review, vol. 145, no. 5, pp. 1897–1918, 2017.
  * [7] P. Van Leeuwen, L. Nerger, R. Potthast, S. Reich, , and H. Kunsch, “A review of particle filters for geoscience applications,” Quarterly Journal of the Royal Meteorological Society, 2019.
  * [8] F. Lopez, L. Zhang, A. Mok, and J. Beaman, “Particle filtering on GPU architectures for manufacturing applications,” Computers in Industry, vol. 71, pp. 116–127, 2015.
  * [9] A. Gelencsér-Horváth, G. J. Tornai, A. Horváth, and G. Cserey, “Fast, parallel implementation of particle filtering on the GPU architecture,” EURASIP Journal on Advances in Signal Processing, vol. 2013, p. 148, Sep 2013.
  * [10] L. M. Murray, “Bayesian state-space modelling on high-performance hardware using LibBi,” arXiv e-prints, Jun 2013.
  * [11] F. Bai and X. Hu, “Cloud MapReduce for particle filter-based data assimilation for wildfire spread simulation,” in Proceedings of the High Performance Computing Symposium, HPC ’13, (San Diego, CA, USA), pp. 11:1–11:6, Society for Computer Simulation International, 2013.
  * [12] F. Bai, F. Gu, X. Hu, and S. Guo, “Particle routing in distributed particle filters for large-scale spatial temporal systems,” IEEE Transactions on Parallel and Distributed Systems, vol. 27, pp. 481–493, Feb 2016\.
  * [13] T. Blattner and S. Yang, “Performance study on CUDA GPUs for parallelizing the local ensemble transformed Kalman filter algorithm,” Concurrency and Computation: Practice and Experience, vol. 24, no. 2, pp. 167–177, 2012\.
  * [14] S.-C. Wei and B. Huang, “A GPU-accelerated extended Kalman filter,” in High-Performance Computing in Remote Sensing (B. Huang and A. J. Plaza, eds.), vol. 8183, pp. 35 – 42, International Society for Optics and Photonics, SPIE, 2011.
  * [15] J. C. Quinn and H. D. Abarbanel, “Data assimilation using a GPU accelerated path integral Monte Carlo approach,” Journal of Computational Physics, vol. 230, no. 22, pp. 8168–8178, 2011.
  * [16] V. Lee, C. Kim, J. Chhugani, M. Deisher, D. Kim, A. Nguyen, N. Satish, M. Smelyanskiy, S. Chennupaty, P. Hammarlund, R. Singhal, and P. Dubey, “Debunking the 100x GPU vs. CPU myth: an evaluation of throughput computing on CPU and GPU,” in ISCA ’10: Proceedings of the 37th annual international symposium on Computer architecture, (New York, NY, USA), pp. 451–460, ACM, 2010.
  * [17] A. Apte, C. K. R. T. Jones, and A. M. Stuart, “A Bayesian approach to Lagrangian data assimilation,” Tellus A: Dynamic Meteorology and Oceanography, vol. 60, no. 2, pp. 336–347, 2008.
  * [18] E. T. Spiller, A. Apte, and C. K. R. T. Jones, “Assimilating en-route Lagrangian observations,” Tellus A: Dynamic Meteorology and Oceanography, vol. 65, no. 1, pp. 1–14, 2013.
  * [19] E. T. Spiller, A. Budhiraja, K. Ide, and C. K. Jones, “Modified particle filter methods for assimilating Lagrangian data into a point-vortex model,” Physica D: Nonlinear Phenomena, vol. 237, no. 10, pp. 1498–1506, 2008.  Perspectives in Fluid Dynamics.
  * [20] L. Kuznetsov, K. Ide, and C. K. R. T. Jones, “A method for assimilation of Lagrangian data,” Monthly Weather Review, vol. 131, no. 10, pp. 2247–2260, 2003.
  * [21] A. Apte and C. K. R. T. Jones, “The impact of nonlinearity in Lagrangian data assimilation,” Nonlinear Processes in Geophysics, vol. 20, no. 3, pp. 329–341, 2013.
  * [22] M. J. Carrier, H. Ngodock, S. Smith, G. Jacobs, P. Muscarella, T. Ozgokmen, B. Haus, and B. Lipphardt, “Impact of assimilating ocean velocity observations inferred from Lagrangian drifter data using the NCOM-4DVAR,” Monthly Weather Review, vol. 142, no. 4, pp. 1509–1524, 2014.
  * [23] L. Slivinski, E. Spiller, A. Apte, and B. Sandstede, “A hybrid particle-–ensemble Kalman filter for Lagrangian data assimilation,” Monthly Weather Review, vol. 143, no. 1, pp. 195–211, 2015.
  * [24] L. Slivinski, L. Pratt, I. Rypina, M. Orescanin, B. Raubenheimer, J. MacMahan, and S. Elgar, “Assimilating Lagrangian data for parameter estimation in a multiple-inlet system,” Ocean Modelling, vol. 113, pp. 131–144, 2017.
  * [25] J. S. Liu and R. Chen, “Sequential Monte Carlo methods for dynamic systems,” Journal of the American Statistical Association, vol. 93, pp. 1032–1044, 1998.
  * [26] A. Doucet, S. Godsill, and C. Andrieu, “On sequential Monte Carlo sampling methods for Bayesian filtering,” Statistics and Computing, vol. 10, pp. 197–208, Jul 2000.
  * [27] M. Ades and P. J. van Leeuwen, “An exploration of the equivalent weights particle filter,” Quarterly Journal of the Royal Meteorological Society, vol. 139, no. 672, pp. 820–840, 2013.
  * [28] M. Zhu, P. J. van Leeuwen, and J. Amezcua, “Implicit equal-weights particle filter,” Quarterly Journal of the Royal Meteorological Society, vol. 142, no. 698, pp. 1904–1919, 2016.
  * [29] A. J. Chorin, M. Morzfeld, and X. Tu, A survey of implicit particle filters for data assimilation, pp. 63–88.  New York, NY: Springer New York, 2013.
  * [30] J. Skauvold, J. Eidsvik, P. J. van Leeuwen, and J. Amezcua, “A revised implicit equal-weights particle filter,” Quarterly Journal of the Royal Meteorological Society, vol. 145, no. 721, pp. 1490–1502, 2019.
  * [31] A. F. Shchepetkin and J. C. McWilliams, “The regional oceanic modeling system (ROMS): a split-explicit, free-surface, topography-following-coordinate oceanic model,” Ocean Modelling, vol. 9, no. 4, pp. 347–404, 2005.
  * [32] M. Gurvan, R. Bourdallé-Badie, P.-A. Bouttier, C. Bricaud, D. Bruciaferri, D. Calvert, J. Chanut, E. Clementi, A. Coward, D. Delrosso, C. Ethé, S. Flavoni, T. Graham, J. Harle, D. Iovino, D. Lea, C. Lévy, T. Lovato, N. Martin, S. Masson, S. Mocavero, J. Paul, C. Rousset, D. Storkey, A. Storto, and M. Vancoppenolle, “NEMO ocean engine,” Oct 2017.
  * [33] K. H. Christensen, Ø. Breivik, K.-F. Dagestad, J. Röhrs, and B. Ward, “Short-term predictions of oceanic drift,” Oceanography, vol. 31, pp. 59–67, September 2018.
  * [34] R. J. LeVeque, Finite Volume Methods for Hyperbolic Problems.  Cambridge University Press, 2004.
  * [35] T. R. Hagen, M. O. Henriksen, J. M. Hjelmervik, and K.-A. Lie, How to solve systems of conservation laws numerically using the graphics processor as a high-performance computational engine, pp. 211–264.  Berlin, Heidelberg: Springer Berlin Heidelberg, 2007.
  * [36] A. R. Brodtkorb, M. L. Sætra, and M. Altinakar, “Efficient shallow water simulations on GPUs: Implementation, visualization, verification, and validation,” Computers & Fluids, vol. 55, no. 0, pp. 1–12, 2012.
  * [37] M. de la Asunción, J. Mantas, and M. Castro, “Simulation of one-layer shallow water systems on multicore and CUDA architectures,” The Journal of Supercomputing, vol. 58, pp. 206–214, Nov 2011.
  * [38] H. Meuer, E. Strohmaier, J. Dongarra, and H. Simon, “Top 500 supercomputer sites.” http://www.top500.org/, November 2018.
  * [39] H. Sutter, “The free lunch is over: A fundamental turn toward concurrency in software,” Dr. Dobb’s Journal, vol. 30, no. 3, pp. 202–210, 2005.
  * [40] J. Sanders and E. Kandrot, CUDA by Example: An Introduction to General-Purpose GPU Programming.  Addison-Wesley Professional, 2010.
  * [41] A. Klöckner, N. Pinto, Y. Lee, B. Catanzaro, P. Ivanov, and A. Fasih, “PyCUDA and PyOpenCL: A scripting-based approach to GPU run-time code generation,” Parallel Computing, vol. 38, no. 3, pp. 157–174, 2012.
  * [42] T. Oliphant, Guide to NumPy.  Trelgol Publishing, 2006.
  * [43] J. Hunter, “Matplotlib: A 2d graphics environment,” Computing In Science & Engineering, vol. 9, no. 3, pp. 90–95, 2007.
  * [44] T. Kluyver, B. Ragan-Kelley, F. Pérez, B. Granger, M. Bussonnier, J. Frederic, K. Kelley, J. Hamrick, J. Grout, S. Corlay, P. Ivanov, D. Avila, S. Abdalla, C. Willing, and Jupyter development team, “Jupyter notebooks – a publishing format for reproducible computational workflows,” in Positioning and Power in Academic Publishing: Players, Agents and Agendas, pp. 87–90, 2016.
  * [45] A. Chertock, M. Dudzinski, A. Kurganov, and M. Lukácová-Medvidová, “Well-balanced schemes for the shallow water equations with Coriolis forces,” Numerische Mathematik, Dec 2017.
  * [46] H. Holm and A. Brodtkorb, “Adapting a two-dimensional finite volume scheme for real-world oceanographic simulations,” 2019.  [preprint].
  * [47] S. Hatfield, A. Subramanian, T. Palmer, and P. Düben, “Improving weather forecast skill through reduced-precision data assimilation,” Monthly Weather Review, vol. 146, no. 1, pp. 49–62, 2018.
  * [48] M. Harris, “Optimizing parallel reduction in CUDA,” tech. rep., Nvidia Developer Technology, 2007.
  * [49] J. Galewsky, R. K. Scott, and L. M. Polvani, “An initial-value problem for testing numerical models of the global shallow-water equations,” Tellus A: Dynamic Meteorology and Oceanography, vol. 56, no. 5, pp. 429–440, 2004.
  * [50] T. M. Hamill, “Interpretation of rank histograms for verifying ensemble forecasts,” Monthly Weather Review, vol. 129, no. 3, pp. 550–560, 2001\.