Skip to content
Prev 16997 / 29559 Next

problems drawing a world map on a levelplot

summary: How to best/easiest range-shift lon-lat data?

details:

https://stat.ethz.ch/pipermail/r-sig-geo/2012-December/017011.html
<self-administered dopeslap/> Of course! the problem is my input!
see starred line:

R session
* extent      : -1.25, 358.75, -90.94737, 90.94737  (xmin, xmax, ymin, ymax)
which is wrong:

- latitudes outside the range [-90, +90]?

- (as you note) 0-based longitudes are likely troublesome (I'm pretty
  sure the other data with which this must integrate is [-180, +180])

- ... and these longitudes aren't even 0-based!

I didn't even check :-( since the data's source is much more eminent
than a mere student like myself. But now I note

$ ncdump -h ./2008N2O_restart.nc | head
$ ncdump -v lat ./2008N2O_restart.nc | tail -n 28
I'm not sure why raster is reporting y range=[-90.94737, 90.94737],
except that 2 * 0.94737 = 1.89474 == the latitude resolution.

$ ncdump -v lon ./2008N2O_restart.nc | tail -n 15
Again, it seems raster is reporting range(x)=[-1.25, 358.75] only
because resolution(x)=2.5?. I'll defer to its superior wisdom.

Given my need to integrate this data with other more conventional,
longitudes=[-180, +180] datasets, it seems better to fix this data than
to fix wrld_simpl. So I'm wondering, how best to "shift" my data from
longitudes=[0, 360] to longitudes=[-180, +180]?

TIA, Tom Roche <Tom_Roche at pobox.com>