nansat icon indicating copy to clipboard operation
nansat copied to clipboard

Reproject retruns NaN band values

Open korvinos opened this issue 2 years ago • 0 comments

Description

Given two grids (A and B) defined in the lat and long coordinates and covering the same area in the Southern hemisphere:

  • Grid A is from a Sentinel-1 IW subswath (i.e., a small grid with a higher resolution that is rotated with respect to the true North). This grid covers an area within grid B.
  • Grid B is from a CMEMS product (i.e., bigger grid with a lower resolution that is regular with respect to true north)

Based on these two grids I created two Nansat objects (a_nsat, b_nsat) that were filled with some bands. The goal is to reproject data from grid B to grid A.

In [105]: a_nsat
Out[105]: 
----------------------------------------
None----------------------------------------
Mapper: NoneBand : 1 lon
  dataType: 6
  name: lon
  SourceBand: 1
  SourceFilename: /vsimem/OFV4Z0QFQK.vrt
Band : 2 lat
  dataType: 6
  name: lat
  SourceBand: 1
  SourceFilename: /vsimem/2KXNJ2492Q.vrt
----------------------------------------
Domain:[110 x 233]
----------------------------------------
Projection(gcps):
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]
----------------------------------------
Corners (lon, lat):
         ( 29.03, -35.67)  ( 30.03, -35.44)
         ( 28.43, -33.84)  ( 29.41, -33.61)
In [106]: b_nsat
Out[106]: 
----------------------------------------
None----------------------------------------
Mapper: NoneBand : 1 lon
  dataType: 6
  name: lon
  SourceBand: 1
  SourceFilename: /vsimem/71ODHPD5K5.vrt
Band : 2 lat
  dataType: 6
  name: lat
  SourceBand: 1
  SourceFilename: /vsimem/ALHWP9SL39.vrt
----------------------------------------
Domain:[180 x 81]
----------------------------------------
Projection(gcps):
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]
----------------------------------------
Corners (lon, lat):
         (  0.12, -44.87)  ( 45.12, -44.87)
         (  0.12, -24.62)  ( 45.12, -24.62)

Problem

b_nsat.reproject(a_nsat) returns NaN values for all bands in the b_nsat

Data

Lon and Lat values for both A and B grids can be accessed here https://nerscno-my.sharepoint.com/:f:/g/personal/artem_moiseev_nersc_no/EqfrdIFkqodOky_qgTfcHIIBvvq98tcagI0jTyquXdnL7Q?e=UeXiY9

korvinos avatar Mar 11 '22 08:03 korvinos