Skip to content

Commit

Permalink
Merge pull request SciTools#1251 from QuLogic/cython-trace
Browse files Browse the repository at this point in the history
Convert trace.cpp to Cython
  • Loading branch information
pelson authored Dec 31, 2018
2 parents 17cadcd + 243c0c8 commit 427de4f
Show file tree
Hide file tree
Showing 9 changed files with 629 additions and 801 deletions.
5 changes: 2 additions & 3 deletions lib/cartopy/_crs.pxd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2010 - 2016, Met Office
# (C) British Crown Copyright 2010 - 2018, Met Office
#
# This file is part of cartopy.
#
Expand All @@ -16,8 +16,7 @@
# along with cartopy. If not, see <https://www.gnu.org/licenses/>.


cdef extern from "proj_api.h":
ctypedef void *projPJ
from ._proj4 cimport projPJ


cdef class CRS:
Expand Down
14 changes: 3 additions & 11 deletions lib/cartopy/_crs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,9 @@ cimport numpy as np
from cython.operator cimport dereference as deref


cdef extern from "proj_api.h":
ctypedef void *projPJ
projPJ pj_init_plus(char *)
void pj_free(projPJ)
int pj_transform(projPJ, projPJ, long, int, double *, double *, double *)
int pj_is_latlong(projPJ)
char *pj_strerrno(int)
int *pj_get_errno_ref()
char *pj_get_release()
double DEG_TO_RAD
double RAD_TO_DEG
from ._proj4 cimport (pj_init_plus, pj_free, pj_transform, pj_is_latlong,
pj_strerrno, pj_get_errno_ref, pj_get_release,
DEG_TO_RAD, RAD_TO_DEG)


cdef double NAN = float('nan')
Expand Down
39 changes: 39 additions & 0 deletions lib/cartopy/_proj4.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# (C) British Crown Copyright 2018, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cartopy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with cartopy. If not, see <https://www.gnu.org/licenses/>.

"""
This file declares the Proj API, version 4.
"""


cdef extern from "proj_api.h":
ctypedef void *projPJ
ctypedef struct projLP:
double u
double v

projPJ pj_init_plus(char *) nogil
void pj_free(projPJ) nogil
void pj_get_spheroid_defn(projPJ, double *, double *) nogil
int pj_transform(projPJ, projPJ, long, int, double *, double *, double *) nogil
int pj_is_latlong(projPJ) nogil
char *pj_strerrno(int) nogil
int *pj_get_errno_ref() nogil
char *pj_get_release() nogil
cdef double DEG_TO_RAD
cdef double RAD_TO_DEG
Loading

0 comments on commit 427de4f

Please sign in to comment.