Search code examples
pythongiscartopysatellite-image

Using cartopy to project geostationary data points onto a regular grid


I'm trying to use Cartopy to project GOES satellite imagery data onto a regular grid across the USA. I'm doing something wrong with my translation from GOES to grid at the end of this colab workbook. I'm doing this:

geos.transform_point(us_bbox[0][0] + x, us_bbox[0][1] + y, ccrs.PlateCarree()) / sat_h

As you can see from the image at the end, it isn't projecting onto the grid and is getting distorted somehow.

Edit: here's a bit more of the code from the colab workbook:

grid_width = 500
grid_height = 500
grid = np.zeros((grid_width, grid_height))

for x in range(0, grid_width):
  for y in range(0, grid_height):
    location_geos = geos.transform_point(us_bbox[0][0] + x, us_bbox[0][1] + y, ccrs.PlateCarree()) / sat_h
    if not np.any(np.isnan(location_geos)):
      grid[(x, y)] = C['BCM'].sel(y=location_geos[1],x=location_geos[0],method='nearest').values

Any help would be greatly appreciated.

enter image description here


Solution

  • Probably a really silly question, as I don't know the libraries in question, but in the line

    location_geos = geos.transform_point(us_bbox[0][0] + x, us_bbox[0][1] + y, ccrs.PlateCarree()) / sat_h
    

    are you adding latitude/longitude (us_bbox values) to integers (x, y)? If so your final plotted image has a range of 500 degrees latitude/longitude and, actually, this might make sense of the image.