Find nearest grid cell between two 2D matrixes of different resolution
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Melissa
il 15 Mag 2015
Commentato: Walter Roberson
il 15 Mag 2015
Hello,
I have two matrices I would like to compare.
A is 192(lon) x 288(lat) B is 360(lat) x 720(lon)
How can I regrid B so that its resolution is the same as A?
I would like to know how to do this both by finding the nearest B lat&lon&values for A, and also by decimating B to the coarser resolution of A
Thank you,
Melissa
0 Commenti
Risposta accettata
Walter Roberson
il 15 Mag 2015
Assuming that they are regular grids with known latitude and longitude vectors, Along, Alat, Blong, Blat, then the approximation that neglects curvature of the Earth would be
[X, Y] = meshgrid(Blat, Blong);
[Xq, Yq] = meshgrid(Alat, Along);
Bapprox = interp2(X, Y, B, Xq, Yq);
The interp2() would need the longitude vectors phase-unwrapped if they cross 180 to -180:
degrad = pi./180;
unwrappedBlong = unwrap(Blong .* degrad) ./ degrad;
If you do need to take the curvature of the Earth into account, then possibly mapprofile might turn out to be usable for you -- I am too tired at the moment to figure out what a refmatrix is.
If mapprofile is not suitable then perhaps someone has already built a routine. If not then intrplon might help.
2 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!