Skip to content

[Multi_Precision_Calculation]Unique_coordinates_detection_through_input_vertices - #320

Closed
hongyuchen1030 wants to merge 8 commits into
UXARRAY:mainfrom
hongyuchen1030:Arbitrary_precision_latlonbounds
Closed

hongyuchen1030 wants to merge 8 commits into
UXARRAY:mainfrom
hongyuchen1030:Arbitrary_precision_latlonbounds

Conversation

@hongyuchen1030

@hongyuchen1030 hongyuchen1030 commented May 19, 2023 •

Copy link
Copy Markdown
Contributor

Finish the 1st step of #318

Overview

This will convert every user input coordinates to the user-specified precision gmpy2.mpfr types. It can recognize two coordinates even though they're extremely closed up to any gmpy2 supported precision. To achieve the precision higher than pythonfloat (53 bits), it's highly recommended that users use the string as input. This PR also introduce new constant for multi-precision usage:

  1. INT_FILL_VALUE_MPZ: The filled value that represented by the gmpy2.mpz type, the value will be the same as INT_FILL_VALUE
  2. FLOAT_PRECISION_BITS: 53, the pythonfloat precision bits

For more information about the multi-precision and exact computation paradigm, please refers to the following materials
GMPY2
The Exact Computation Paradigm

Expected Usage

import uxarray as ux

# Provide nodes that are extremely closed to each other
face_nodes_connectivity = [['1.000000000000000000', '1.000000000000000000001', '1.0000000000000000000012'],
 ['1.000000000000000001', '1.000000000000000000002', '1.0000000000000000000013']]

uxgrid =   ux.Grid(face_nodes_connectivity, multi_precision=True, precision= 65,
                        vertices=True,
                        islatlon=False,
                        concave=False)
print(uxgrid.nMesh2_face )# It will still detect two faces without degenration
>>> 2

# Perform any provided grid manipulation and then the results is precise up the the 65 bits

Proposed Progress

Data Read in

  • Support multi-precision when initializing through Grid.__from_vert__()
  • Support multi-precision when initializing through Grid.__from_ds__()

Grid Pre-processing

  • Precise spherical and cartesian coordinates conversion
  • Build exact Latitude Longitude bound

Grid Operation

  • Exact intersection between two great circle arcs (GCR)
  • Exact intersection between a GCR and a constant latitude
  • Exact Non-conservative Zonal Average

Grid Construction

  • Exact conservative zonal regrinding.

PR Checklist

General

  • An issue is linked created and linked
  • Add appropriate labels
  • Filled out Overview and Expected Usage (if applicable) sections

Testing

  • Adequate tests are created if there is new functionality
  • Tests cover all possible logical paths in your function
  • Tests are not too basic (such as simply calling a function and nothing else)

Documentation

  • Docstrings have been added to all new functions
  • Docstrings have updated with any function changes
  • Internal functions have a preceding underscore (_) and have been added to docs/internal_api/index.rst
  • User functions have been added to docs/user_api/index.rst

Examples

  • Any new notebook examples added to docs/examples/ folder
  • Clear the output of all cells before committing
  • New notebook files added to docs/examples.rst toctree
  • New notebook files added to new entry in docs/gallery.yml with appropriate thumbnail photo in docs/_static/thumbnails/

@hongyuchen1030 hongyuchen1030 added the new feature New user-facing functionality label May 19, 2023
@hongyuchen1030 hongyuchen1030 self-assigned this May 19, 2023
@hongyuchen1030
hongyuchen1030 marked this pull request as draft May 19, 2023 21:45
@hongyuchen1030 hongyuchen1030 linked an issue May 19, 2023 that may be closed by this pull request
3 of 10 tasks
@hongyuchen1030 hongyuchen1030 changed the title Multi_Precision_Calculation_Support [Multi_Precision_Calculation]Unique_coordinates_detection_through_input_vertices May 20, 2023
@hongyuchen1030
hongyuchen1030 deleted the Arbitrary_precision_latlonbounds branch May 20, 2023 19:21
@hongyuchen1030 hongyuchen1030 linked an issue Jun 6, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New user-facing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorporating GMPY2 for multiple precision calculation

1 participant