Skip to content

Multiprecision unique coords detection through verts - #321

Merged
philipc2 merged 56 commits into
UXARRAY:multi_precisionfrom
hongyuchen1030:multiprecision_unique_coords_detection_through_verts
Jul 12, 2023
Merged

philipc2 merged 56 commits into
UXARRAY:multi_precisionfrom
hongyuchen1030:multiprecision_unique_coords_detection_through_verts

Conversation

@hongyuchen1030

@hongyuchen1030 hongyuchen1030 commented May 20, 2023 •

Copy link
Copy Markdown
Contributor

Finish the 1st step of #318
Data Read in

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

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

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 self-assigned this May 20, 2023
@hongyuchen1030 hongyuchen1030 added the new feature New user-facing functionality label May 20, 2023
@hongyuchen1030 hongyuchen1030 linked an issue May 20, 2023 that may be closed by this pull request
3 of 10 tasks
@hongyuchen1030

Copy link
Copy Markdown
Contributor Author

@philipc2 @anissa111
The pre-commit keeps failing after I added the jupyter notebook example example/004-multiprecision-usage.ipynb

Can you help me to take a look into that? Thanks

@aaronzedwick

Copy link
Copy Markdown
Member

@hongyuchen1030 Thanks for all the help, I made my own repo and made a branch like you said. You should be able to see all the changes on https://github.com/aaronzedwick/uxarray/tree/multiprecision_unique_coords_detection_through_ds If you need me to change or do anything else just message me on slack.

@philipc2
philipc2 changed the base branch from main to multi_precision June 15, 2023 17:23
@philipc2

Copy link
Copy Markdown
Member

@hongyuchen1030

While we figure our and work out an adequate design for releasing multi-precision support, I've created a protected branch multi_precision that you can make PR's to instead of directly to main

This should also allow future PR's, like the ones @aaronzedwick is working on to use multi_precision as a base and then make changes to then push back into multi_precision.

We will also have a PR similar to the ongoing Redesign one that will be the one that merges into main once it is ready.

Let me know if this works and if I can clarify anything! Hopefully this speeds up development,

@hongyuchen1030

Copy link
Copy Markdown
Contributor Author

@hongyuchen1030

While we figure our and work out an adequate design for releasing multi-precision support, I've created a protected branch multi_precision that you can make PR's to instead of directly to main

This should also allow future PR's, like the ones @aaronzedwick is working on to use multi_precision as a base and then make changes to then push back into multi_precision.

We will also have a PR similar to the ongoing Redesign one that will be the one that merges into main once it is ready.

Let me know if this works and if I can clarify anything! Hopefully this speeds up development,

Thank you very much for your help! That works for me!

@philipc2

Copy link
Copy Markdown
Member

@hongyuchen1030
While we figure our and work out an adequate design for releasing multi-precision support, I've created a protected branch multi_precision that you can make PR's to instead of directly to main
This should also allow future PR's, like the ones @aaronzedwick is working on to use multi_precision as a base and then make changes to then push back into multi_precision.
We will also have a PR similar to the ongoing Redesign one that will be the one that merges into main once it is ready.
Let me know if this works and if I can clarify anything! Hopefully this speeds up development,

Thank you very much for your help! That works for me!

Fantastic! I'll start reviewing it now, since there won't be much pressure on making it ready for main just yet.

@hongyuchen1030

Copy link
Copy Markdown
Contributor Author

Hi @aaronzedwick, can you help me figure out the readthedoc issue and merge this PR into the UXARRAY:multi_precision branch? Thanks

@philipc2 philipc2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hongyuchen1030

There appears to be an issue with the Area Calculation notebook. I'll look into it.

@aaronzedwick

Copy link
Copy Markdown
Member

My ds branch also failed the readthedocs previously. Could be for the same reason, let me know if you figure anything out, I don't know much about how the check works.

@rajeeja

rajeeja commented Jun 22, 2023

Copy link
Copy Markdown
Contributor

My ds branch also failed the readthedocs previously. Could be for the same reason, let me know if you figure anything out, I don't know much about how the check works.

See failure messages here - https://readthedocs.org/projects/uxarray/builds/21083976/

@hongyuchen1030

Copy link
Copy Markdown
Contributor Author

Hi @philipc2, Do you have any idea in mind about why the read-doc fails and how to fix it?

@philipc2

philipc2 commented Jun 30, 2023 •

Copy link
Copy Markdown
Member

@hongyuchen1030

I'm not sure what happened, but the Face Area notebook was corrupted, causing the docs to fail. I've manually replaced it.

@aaronzedwick

Copy link
Copy Markdown
Member

@hongyuchen1030 If we can get this branch merged it will make it easier to merge other branches, like my from_ds function. Right now the multi-precision branch doesn't have any of the multi-precision helpers or functions. Getting this merged would add those to the branch.

@hongyuchen1030

hongyuchen1030 commented Jul 12, 2023 •

Copy link
Copy Markdown
Contributor Author

@hongyuchen1030 If we can get this branch merged it will make it easier to merge other branches, like my from_ds function. Right now the multi-precision branch doesn't have any of the multi-precision helpers or functions. Getting this merged would add those to the branch.

I understand, but so far, without the reviewers approval, I am unable to merge it. @philipc2 Can you take a look of this PR and see if you can approve it? Thanks

@hongyuchen1030
hongyuchen1030 requested a review from philipc2 July 12, 2023 15:03

@philipc2 philipc2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving tentatively to speed up development, with a detailed review expected when multi_precision is merged into man

@philipc2
philipc2 merged commit 86ed3ce into UXARRAY:multi_precision Jul 12, 2023
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 Precision issue from Grid.__from_vert__() using np.unique()

6 participants