You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The exchange grid tool uses a function poly_area(), which returns the area of a polygon on globe with given vertices, to calculate the (exchange) grid cell areas. This function gives an unreasonably large values when the side of such polygons crosses a pole. This is because the line inegral formula which the function is based on is not valid when such crossing happens and is bigger than what it should be by pi*R**2 (which explains why the returned area is almost half the area of the Earth).
This pole crossing happens mostly for stretched ATM grids (non-GCA) giving rise to tiling errors for those grids and holes in the Antarctic land_mask.
To Reproduce
Get a version of frenctools with more verbosity for the exchange grid creation tool:
Now create a coupled mosaic with a stretched grid for ATM such as c256r25tlat32.0_om4p25.
Explore the values of area_atm array along the longitude in the tile that contains the south pole (land_mask_tile3.nc) . See figure below.
Expected behavior
area_atm should not give huge values.
System Environment
fre-nctools on PAN
Additional context
See issue #44 for the inaccuracies in poly_area even for non-stretched grids.
Figure below shows the value of area_atm in land_mask_tile3.nc
- Closes issue NOAA-GFDL#180
- The centroid latitude calculation in ploy_ctrlat() needs a small fix similar to the fix in issue NOAA-GFDL#45
for grid cells staddling the South pole but not including it as a vertex.
- Added/corrected comments in poly_area().
- Cleaned up poly_area() of unneeded code.
- Closes issue NOAA-GFDL#180
- The centroid latitude calculation in ploy_ctrlat() needs a small fix similar to the fix in issue NOAA-GFDL#45
for grid cells staddling the South pole but not including it as a vertex.
- Added/corrected comments in poly_area().
Describe the bug
The exchange grid tool uses a function poly_area(), which returns the area of a polygon on globe with given vertices, to calculate the (exchange) grid cell areas. This function gives an unreasonably large values when the side of such polygons crosses a pole. This is because the line inegral formula which the function is based on is not valid when such crossing happens and is bigger than what it should be by pi*R**2 (which explains why the returned area is almost half the area of the Earth).
This pole crossing happens mostly for stretched ATM grids (non-GCA) giving rise to tiling errors for those grids and holes in the Antarctic land_mask.
To Reproduce
Get a version of frenctools with more verbosity for the exchange grid creation tool:
Now create a coupled mosaic with a stretched grid for ATM such as c256r25tlat32.0_om4p25.
Explore the values of area_atm array along the longitude in the tile that contains the south pole (land_mask_tile3.nc) . See figure below.
Expected behavior
area_atm should not give huge values.
System Environment
fre-nctools on PAN
Additional context
See issue #44 for the inaccuracies in poly_area even for non-stretched grids.
Figure below shows the value of area_atm in land_mask_tile3.nc
Same as above after a fix to poly_area formulation to take into account the pole crossing for a polygon edge.
There is still the discontinuity mentioned in issue #44
The text was updated successfully, but these errors were encountered: