mdsumner / ghrsst.coop

0 stars 0 forks source link

the ghrsst grid weirdness #5

Open mdsumner opened 4 months ago

mdsumner commented 4 months ago

/archive.podaac.earthdata.nasa.gov/podaac-ops-cumulus-protected/MUR-JPL-L4-GLOB-v4.1/202420240202090000-JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1.

mdsumner commented 4 months ago
ex <- c(-180, 180, -89.875, 89.875)
diff(ex)[1]/36000
#> [1] 0.01
diff(ex)[3]/17999
#> [1] 0.009986666
length(seq(-90 + 0.01/2, 90 - 0.01/2, by = 0.01))
#> [1] 18000

length(seq(89.9905, -89.9905, by = -0.01))
#> [1] 17999
#[1] 17999

ncsrc <- "/rdsi/PUBLIC/raad/data/podaac-opendap.jpl.nasa.gov/opendap/allData/ghrsst/data/GDS2/L4/GLOB/JPL/MUR/v4.1/2002/152/20020601090000-JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1.nc"

gdalex <- vapour::vapour_raster_info(sprintf("NetCDF:%s:analysed_sst", ncsrc))$extent
#[1] -179.995  180.005  -89.995   89.995

lat <- angstroms::rawdata(ncsrc, "lat")
lon <- angstroms::rawdata(ncsrc, "lon")

print(range(lon))
#> [1] -179.99  180.00
print(range(lat))
#> [1] -89.99  89.99
par(mfrow = c(2, 2))
## UL --------------------------------------------------------------------------
plot(NA, xlim = c(-180, -179.95), ylim = c(89.95, 90), asp = 1, xlab = "lon", ylab = "lat")
abline(v = -180, h = 90)
points(expand.grid(head(lon), tail(lat)))
vaster::plot_extent(gdalex, border = "red", add = TRUE)

#abline(v = seq(-180, -179, by = 0.01))
#abline(h = seq(90, 89.95, by = -0.01))
#abline(h = 89.9905)

## UR --------------------------------------------------------------------------
plot(NA, xlim = c(179.95, 180), ylim = c(89.95, 90), asp = 1, xlab = "lon", ylab = "lat")
title("maxlat = max(lat)")
abline(v = 180, h = 90)
points(expand.grid(tail(lon), tail(lat)))
vaster::plot_extent(gdalex, border = "red", add = TRUE)
## LL --------------------------------------------------------------------------
plot(NA, xlim = c(-180, -179.95), ylim = c(-90, -89.95), asp = 1, xlab = "lon", ylab = "lat")
abline(v = -180, h = -90)
points(expand.grid(head(lon), head(lat)))
vaster::plot_extent(gdalex, border = "red", add = TRUE)
## LR --------------------------------------------------------------------------
plot(NA, xlim = c(179.95, 180), ylim = c(-90, -89.95), asp = 1, xlab = "lon", ylab = "lat")
abline(v = 180, h = -90)
points(expand.grid(tail(lon), head(lat)))
vaster::plot_extent(gdalex, border = "red", add = TRUE, xlab = "lon", ylab = "lat")

Created on 2024-02-23 by the reprex package (v2.0.1)

mdsumner commented 4 months ago

fleshed this out more over at this gist: https://gist.github.com/mdsumner/66aac8e54b54faa24e14b63f396dca32