Generate lat/lon coords from already projected data [message #58865] |
Thu, 21 February 2008 14:22 |
becky_s
Messages: 4 Registered: February 2008
|
Junior Member |
|
|
Greetings!
I am attempting to generate an array of latitudes and longitudes that
will match an orthographic plot of data over the entire northern
hemisphere, centered on the north pole.
I have a 1024x1024 array which contains the data (which we'll call
ccover). It is arranged with zero values around the "edges" of the
array, so that if you TV ccover, it appears as a circular plot of the
entire northern hemisphere. Of, if you just simply printed ccover, it
looks something like this:
0 0 0 0 0 0 0 0 0 0
0 0 0 0 x.x 0 0 0 0
0 0 x x x x x x 0 0
0 x x x x x x x x 0
0 0 x x x x x x 0 0
0 0 0 0 x x 0 0 0 0
0 0 0 0 0 0 0 0 0 0
where the x's are data values. Basically, it's already been
orthographically projected before I even got my hands on it. Prior to
this projection, the resolution of the data was 24 km. I also know
that the widest part of the globe in ccover corresponds to 999 points,
in both the horizontal and the vertical.
However, I would like to be able to generate the latitude and
longitude values that correspond to each member of my ccover array. I
figured I would need to do something like the following:
;generate cartesian coordinates
nx = 999 & ny = 999
delta_x = 24000 & delta_y = 24000
x = dx * findgen(nx)
y = dy * findgen(ny)
;fiddle with dimensions
x2d = rebin(x, nx, ny)
y2d = rebin(reform(y, 1, ny), nx, ny)
;run the map calculations
globe = MAP_PROJ_INIT(2, center_longitude=0, center_latitude=90)
lonlat = MAP_PROJ_INVERSE(x2d, y2d, MAP_STRUCTURE=globe)
;more dimension fiddling
lon = reform(lonlat[0,*], nx, ny)
lat = reform(lonlat[1,*], nx, ny)
(This heavily utilized a fantastic post by Mark Hadfield on 4 Jul
2004.) However, I run into lots of problems, one of which is that
lat[0,0] and lon[0,0] are 0W 90N, the center of my map - but
ccover[0,0], the upper left corner of my array, corresponds to a space
not even on the globe. The implicit 24 km resolution bothers me
somewhat too, as I know that there is NOT uniformly 24 km between each
data point in ccover.
Is this fixable/doable? What am I doing wrong? I would greatly
appreciate any help you could provide. Please let me know if I need
to further expand on anything.
Becky
|
|
|