From 3b24a9690c59eeb0d33f7fe1251ff868ed8d2e79 Mon Sep 17 00:00:00 2001 From: Nick Wogan Date: Tue, 26 Nov 2024 08:03:39 -0800 Subject: [PATCH] wrapper for diurnal fact --- photochem/cython/PhotochemVars.pyx | 9 +++++++++ photochem/cython/PhotochemVars_pxd.pxd | 3 +++ photochem/fortran/PhotochemVars_wrapper.f90 | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/photochem/cython/PhotochemVars.pyx b/photochem/cython/PhotochemVars.pyx index 72056fa..c378681 100644 --- a/photochem/cython/PhotochemVars.pyx +++ b/photochem/cython/PhotochemVars.pyx @@ -59,6 +59,15 @@ cdef class PhotochemVars: raise PhotoException("Input array is the wrong size.") var_pxd.photochemvars_particle_radius_set(self._ptr, &dim1, &dim2, arr_.data) + property diurnal_fac: + "double. Default is 0.5, to account for half planet facing the sun." + def __get__(self): + cdef double val + var_pxd.photochemvars_diurnal_fac_get(self._ptr, &val) + return val + def __set__(self, double val): + var_pxd.photochemvars_diurnal_fac_set(self._ptr, &val) + property trop_alt: "double. Tropopause altitude." def __get__(self): diff --git a/photochem/cython/PhotochemVars_pxd.pxd b/photochem/cython/PhotochemVars_pxd.pxd index 4c6a337..18b3a28 100644 --- a/photochem/cython/PhotochemVars_pxd.pxd +++ b/photochem/cython/PhotochemVars_pxd.pxd @@ -26,6 +26,9 @@ cdef extern void photochemvars_particle_radius_get_size(PhotochemVars *ptr, int cdef extern void photochemvars_particle_radius_get(PhotochemVars *ptr, int *dim1, int *dim2, double *arr) cdef extern void photochemvars_particle_radius_set(PhotochemVars *ptr, int *dim1, int *dim2, double *arr) +cdef extern void photochemvars_diurnal_fac_get(PhotochemVars *ptr, double *val) +cdef extern void photochemvars_diurnal_fac_set(PhotochemVars *ptr, double *val) + cdef extern void photochemvars_trop_alt_get(PhotochemVars *ptr, double *val) cdef extern void photochemvars_trop_ind_get(PhotochemVars *ptr, int *val) diff --git a/photochem/fortran/PhotochemVars_wrapper.f90 b/photochem/fortran/PhotochemVars_wrapper.f90 index 12f6af9..2103fd1 100644 --- a/photochem/fortran/PhotochemVars_wrapper.f90 +++ b/photochem/fortran/PhotochemVars_wrapper.f90 @@ -80,6 +80,22 @@ subroutine photochemvars_particle_radius_set(ptr, dim1, dim2, arr) bind(c) var%particle_radius = arr end subroutine + subroutine photochemvars_diurnal_fac_get(ptr, val) bind(c) + type(c_ptr), value, intent(in) :: ptr + real(c_double), intent(out) :: val + type(PhotochemVars), pointer :: var + call c_f_pointer(ptr, var) + val = var%diurnal_fac + end subroutine + + subroutine photochemvars_diurnal_fac_set(ptr, val) bind(c) + type(c_ptr), value, intent(in) :: ptr + real(c_double), intent(in) :: val + type(PhotochemVars), pointer :: var + call c_f_pointer(ptr, var) + var%diurnal_fac = val + end subroutine + subroutine photochemvars_trop_alt_get(ptr, val) bind(c) type(c_ptr), value, intent(in) :: ptr real(c_double), intent(out) :: val