I'm having a hard time figuring out how to project correctly from a Mercator projection to LAT/Lon.
Basically, I have a netCDF file with the following variables:
- LON0 = 42.0 => reference longitude for the conformal projection (°E)
- LAT0 = -30.0 => reference latitude for the conformal projection (°N)
- LONOR = 41.313 => longitude of point x=0,y=0 in the conformal projection (°E)
- LATOR = -31.6997 => latitude of point x=0,y=0 in the conformal projection (°N)
I know that the point (476000,428000) is associated with geographical coordinates : ( 46.2559 , -27.8431 )
However, I can't figure out how to retrieve it by using pyproj transform object. Here is the code I'm using:
from pyproj import Proj,transform
projection_input = " ".join( ("+proj=merc +lon_0=42.0",
"+k=1 +x_0=0 +y_0=0",
"+ellps=WGS84 +datum=WGS84 +units=m",
"+no_defs")
)
inProj = Proj(projection_input)
projection_output = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
outProj = Proj(projection_output)
print transform(inProj, outProj, 476000, 428000)
Which gives me: ([46.27598102655299], [3.8677438926911805])
It has something to do with x_0,y_0 but I don't know what to put in it so I can get the right transformation (projection). How can this be solved by using the variables (only) listed at the top?