Skip to content

PISM: derive corner longitudes with the grid's own y orientation - #60

Open
xihao001 wants to merge 1 commit into
JanStreffing:masterfrom
xihao001:fix/pism-corner-longitudes
Open

PISM: derive corner longitudes with the grid's own y orientation#60
xihao001 wants to merge 1 commit into
JanStreffing:masterfrom
xihao001:fix/pism-corner-longitudes

Conversation

@xihao001

Copy link
Copy Markdown

cell_corners() inverse-projected the corner (x, y) with a proj4 string built from the file's mapping attributes. PROJ's south polar stereographic gives lon = lon_0 + atan2(x, y), but the antarct_cr PISM grids store lon as atan2(x, -y): their y axis runs the other way.

Latitude cannot see the difference, since it depends only on sqrt(x^2 + y^2), and neither can cell_areas(), because a reflection preserves spherical area. The mismatch therefore showed up only in the corner longitudes, mirrored to 180 - lon:

pyproj lon vs the file's lon median 90.000 deg
pyproj lon vs (180 - file's lon) median 0.000 deg

Those corners reach latest_discharge.nc via esm_tools' add_cell_bounds.py, where the iceberg generator averages them for each discharge cell's position. Every berg in a 28-cycle coupled AWIESM3-PISM run was seeded on the wrong side of Antarctica: median position error 79.9 deg, the whole Ross front placed near lon 0, and the Ross basin receiving 0 of the 300 Gt/yr it discharged. They also reach grids.nc as ismp.clo; no ISM exchange there is conservative, so the weights were unaffected, but a conservative remapping would have been silently wrong.

Decided by measurement rather than assumed, so a PISM grid that does follow the PROJ convention keeps working unchanged: _y_sign transforms the centres, compares against the file's own lon, and raises if neither orientation reproduces it. A y-flip is a reflection and reverses the winding, so _is_ccw restores the counterclockwise order SCRIP expects.

After the fix, corner mean vs the file's lon is 0.0000 deg median, and areas are unchanged at 62.22 km2 mean, matching the existing areas.nc.

cell_corners() inverse-projected the corner (x, y) with a proj4 string
built from the file's mapping attributes. PROJ's south polar
stereographic gives lon = lon_0 + atan2(x, y), but the antarct_cr PISM
grids store lon as atan2(x, -y): their y axis runs the other way.

Latitude cannot see the difference, since it depends only on
sqrt(x^2 + y^2), and neither can cell_areas(), because a reflection
preserves spherical area. The mismatch therefore showed up only in the
corner longitudes, mirrored to 180 - lon:

  pyproj lon vs the file's lon         median 90.000 deg
  pyproj lon vs (180 - file's lon)     median  0.000 deg

Those corners reach latest_discharge.nc via esm_tools'
add_cell_bounds.py, where the iceberg generator averages them for each
discharge cell's position. Every berg in a 28-cycle coupled AWIESM3-PISM
run was seeded on the wrong side of Antarctica: median position error
79.9 deg, the whole Ross front placed near lon 0, and the Ross basin
receiving 0 of the 300 Gt/yr it discharged. They also reach grids.nc as
ismp.clo; no ISM exchange there is conservative, so the weights were
unaffected, but a conservative remapping would have been silently wrong.

Decided by measurement rather than assumed, so a PISM grid that does
follow the PROJ convention keeps working unchanged: _y_sign transforms
the centres, compares against the file's own lon, and raises if neither
orientation reproduces it. A y-flip is a reflection and reverses the
winding, so _is_ccw restores the counterclockwise order SCRIP expects.

After the fix, corner mean vs the file's lon is 0.0000 deg median, and
areas are unchanged at 62.22 km2 mean, matching the existing areas.nc.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant