Closed cossatot closed 4 years ago
Thank you for pointing this out, Richard. The oblique Mercator routine changed when we adapted Blocks to work on global models, and one routine that is automatically done is that any segment that spans 0º longitude is split into two segments, with the split endpoint at the prime meridian. I think you're right that faultobliquemercator.m
may not work as a general purpose projection tool, and I recall some issues in trying to use Matlab's Mapping Toolbox and the USGS projection reference in handling these special cases of spanning the prime meridian. Given the other routines within GetElasticPartials.m
, the elastic dislocation solution is output correctly, even if the projected coordinates look funky in the intermediate steps, although there are still issues with stations that lie at exactly 0º longitude (see correction below).
My test, run after generating the variables from the code you posted, is this:
s.lon = s.lon+1e-8; % Perturb station longitudes by ~1 mm
G = GetElasticPartials(f, s);
figure
plot([f.lon1 f.lon2], [f.lat1 f.lat2], 'r')
hold on
quiver(s.lon, s.lat, G(1:3:end, 1), G(2:3:end, 1)); % Just using the first column of the full partials matrix, corresponding to unit strike slip
title('Okada strike-slip via GetElasticPartials.m');
xlabel('deg lon');
ylabel('deg lat');
and it produces:
Hopefully this addresses the issue, although it's a bit unsatisfactory that the projection routine doesn't work as a standalone tool. Seems like moving to proj4 could be a good solution!
Thanks, Jack
Thanks Jack, I'm glad that the issue is handled properly by the code.
It's always frustrating when you're simplest-possible test case is actually a weird edge-case...
Richard
Hi,
I'm using some functions from Blocks to benchmark/test a project I'm working on. Thanks for making the code available and FOSS for such as great project.
One of the issues that I ran into was that the projection done in
faultobliquemercator.m
does not seem to be correct, which causes the displacements from the Okada dislocations to be funky.I have checked the projection against the Proj4 library and do not run into this issue. I've also checked the code against the USGS reference and it looks correct, so I am not sure where the issue is. Nonetheless for my project I am just using Proj4 (I'm not working in Matlab), so it doesn't impact me but I thought I would let yall know.
To test, I'm using a script, which will be below, that takes a vertical strike-slip fault embedded in a grid of points in lon-lat coords, projects things, and does the Okada dislocation for unit strike slip. The results are here:
Here are the points (blue) and fault (red) in geographic coordinates:
Here is everything in the projection from
faultobliquemerc.m
:Here is the resulting Okada solution:
If I use the projected coordinates from Proj4 (in Python, script to follow) and then bring these back into the matlab code, this is what I get for the projected geometries:
And the Okada results look a lot more like what we'd expect:
Here is the matlab code:
And here is the Python code to do the projection:
There is a very small difference in the lats of the fault because Proj4 errors out with a purely 90-striking fault.
I've also tested in some different geometries and the matlab code still does not produce the expected results.
Maybe I'm doing something wrong, though!
Thanks, Richard