My Trying to define a "rotated regular grid" coordinate system in QGIS question about this got closed because there was already an answer to it, which I understand. I went to the answer in question and have done my absolute best to implement it, but it was for a slightly different scenario and it is still not working so I seek help in seeing where I went wrong.
I'm not even sure if my pre-processing leading up to implementing the solution is correct. I am also not completely sure if my attempted solution will even work. Geodesy was never my strong suit and my last class on it what quite some time ago. But in order to explain it I need a lot of space as well as diagrams.
The problem is this:
I have downloaded a raster that is defined in a rotated coordinate system with a virtual north pole at
39.25 N, 162.00 W. I charted this rotation on Google Earth to visualize it:
Now, the solution involves transforming a set of coordinates in the geographic representation (lat, long) to cartesian (x, y, z), performing the rotation, then converting back to geographic representation. At the end of the answer, a simple "one-liner" set of equations was given as follows:
lat = arcsin(cos(ϑ) sin(lat') - cos(lon') sin(ϑ) cos(lat')) lon = atan2(sin(lon'), tan(lat') sin(ϑ) + cos(lon') cos(ϑ)) - φ
What I have done is save the image in
.asc format, which has the ability of having the xy coordinates of the lower-left corner of the raster defined in the headers of a plain text file. Since I had to display it in QGIS before converting it, the coordinates in WGS84 are:
xllcorner -28.342000000000 yllcorner -23.342000000000
Which is, of course, in the Southern Atlantic Ocean, as can be seen when looking at the raster in WGS84 (remember, the lower-left corner is what we are interested in):
So, I took these coordinates and plugged them into a spreadsheet which implements the "one-liner" equations in the solution that I was directed to:
The equations for calculation
lon, respectively are:
=ASIN(COS(B7)*SIN(C13)-COS(C14)*SIN(B7)*COS(C13)) =ATAN2(SIN(C14), TAN(C13)*SIN(B7)+COS(C14)*COS(B7))-B8
These numbers are obviously not correct, but here's an image to drive home how just how not correct it is:
I'm beginning to wonder if the theory behind my implementation of the method is even sound.
Does it make sense to first display the image in WGS84 to grab its "apparent" latlong coordinates in WGS84 and then "de-rotate" them?
I feel like I am in way over my head here but I can't stop thinking about it, I feel like there is some simple piece of the puzzle that is eluding me.
The data that I am working with, as well as a PDF metadata document is here