Comments (3)
Geod and Proj both have __new__
methods. Looking at the python docs, it looks like self
should be changed to cls
for the __new__
method. This is something I noted while looking at this and does nothing to answer your question, sebhahn.
from pyproj.
I tried __init__
vs __new__
with the Geod class this a little when I was fixing issues #64 (PR #65). IMHO Cython's documentation isn't clear enough about what is happening during object creation regarding __new__
and __cinit__
. So, some of this is my conjecture about how the functions __init__
, __cinit__
, and __new__
.
For Proj, the __new__()
is called first, which subsequently calls _proj.Proj.__new__()
, which I assume is an alias for the __cinit__()
. If you were to rename the Proj class function to __init__()
it would happen after the function has been initialized. What is in __new__()
is python code that parses parameters or makes ellipse calculations and passes it up to something that the __cinit__
which interfaces with the rest of the C code (proj.4 library).
That could probably be moved directly into the Cython __cinit__
functions, but then the code would also have to be compiled along with the rest of it.
The __new__
function has a cls
parameter (which is currently confusingly called self as mentioned previously), which should not be stored to because the memory has not yet be allocated, which was what was happening in issue #64 .
TLDR The best answer is that __new__
was a design decision to add functionality in python code, then calls the corresponding Cython code to initialize the C library facing parts. __init__
would happen after __cinit__
meaning that the code in __new__
would not be able to feed into __cinit__
.
from pyproj.
This has changed in the most recent version 2.1.0.
from pyproj.
Related Issues (20)
- error installl pyproj==3.2.1 on debian:12 HOT 3
- UserWarning: Valid PROJ data directory not found HOT 16
- What happened to the `pyproj/aoi.py` module in releases? HOT 1
- Deprecation warning when transforming a single point enclosed in numpy array HOT 1
- LibTiff Vulnerabilities and Dependencies HOT 4
- DOC: Converting from fiona CRS to pyproj.crs.CRS HOT 7
- Add JSON serializeability with PROJJSON? HOT 7
- to_CF for polar_stereographic, with latitude_true_scale, should include latitude_of_projection_origin HOT 2
- Reverse transformation does not produce initial coordinates
- DeprecationWarning: pkg_resources is deprecated as an API. HOT 1
- Support for deprecated and non-deprecated objects HOT 3
- Invert lat lon "Transformer" HOT 1
- Internal Proj Error: proj_create: unrecognized format / unknown name HOT 4
- Inverted x/y for transformation from WSG84 to LV95 (EPSG:2056) HOT 3
- muslinux wheel missing HOT 1
- test_azimuthal_equidistant fails with PROJ 9.4.0 HOT 1
- test failure in test_crs_cf.py HOT 2
- Add proj_query_geodetic_crs_from_datum HOT 2
- 3.6.1: pytest fails in `test/crs/test_crs_cf.py::test_azimuthal_equidistant` unit HOT 1
- A question about pyproj/_datadir.pyx HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyproj.