How to use the pygmt.clib.conversion.kwargs_to_ctypes_array function in pygmt

To help you get started, we’ve selected a few pygmt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GenericMappingTools / pygmt / pygmt / clib / session.py View on Github external
)

        family_int = self._parse_constant(family, valid=FAMILIES, valid_modifiers=VIAS)
        mode_int = self._parse_constant(
            mode, valid=MODES, valid_modifiers=["GMT_GRID_IS_GEO"]
        )
        geometry_int = self._parse_constant(geometry, valid=GEOMETRIES)
        registration_int = self._parse_constant(
            kwargs.get("registration", "GMT_GRID_NODE_REG"), valid=REGISTRATIONS
        )

        # Convert dim, ranges, and inc to ctypes arrays if given (will be None
        # if not given to represent NULL pointers)
        dim = kwargs_to_ctypes_array("dim", kwargs, ctp.c_uint64 * 4)
        ranges = kwargs_to_ctypes_array("ranges", kwargs, ctp.c_double * 4)
        inc = kwargs_to_ctypes_array("inc", kwargs, ctp.c_double * 2)

        # Use a NULL pointer (None) for existing data to indicate that the
        # container should be created empty. Fill it in later using put_vector
        # and put_matrix.
        data_ptr = c_create_data(
            self.session_pointer,
            family_int,
            geometry_int,
            mode_int,
            dim,
            ranges,
            inc,
            registration_int,
            self._parse_pad(family, kwargs),
            None,
        )
github GenericMappingTools / pygmt / pygmt / clib / session.py View on Github external
],  # data
            restype=ctp.c_void_p,
        )

        family_int = self._parse_constant(family, valid=FAMILIES, valid_modifiers=VIAS)
        mode_int = self._parse_constant(
            mode, valid=MODES, valid_modifiers=["GMT_GRID_IS_GEO"]
        )
        geometry_int = self._parse_constant(geometry, valid=GEOMETRIES)
        registration_int = self._parse_constant(
            kwargs.get("registration", "GMT_GRID_NODE_REG"), valid=REGISTRATIONS
        )

        # Convert dim, ranges, and inc to ctypes arrays if given (will be None
        # if not given to represent NULL pointers)
        dim = kwargs_to_ctypes_array("dim", kwargs, ctp.c_uint64 * 4)
        ranges = kwargs_to_ctypes_array("ranges", kwargs, ctp.c_double * 4)
        inc = kwargs_to_ctypes_array("inc", kwargs, ctp.c_double * 2)

        # Use a NULL pointer (None) for existing data to indicate that the
        # container should be created empty. Fill it in later using put_vector
        # and put_matrix.
        data_ptr = c_create_data(
            self.session_pointer,
            family_int,
            geometry_int,
            mode_int,
            dim,
            ranges,
            inc,
            registration_int,
            self._parse_pad(family, kwargs),
github GenericMappingTools / pygmt / pygmt / clib / session.py View on Github external
restype=ctp.c_void_p,
        )

        family_int = self._parse_constant(family, valid=FAMILIES, valid_modifiers=VIAS)
        mode_int = self._parse_constant(
            mode, valid=MODES, valid_modifiers=["GMT_GRID_IS_GEO"]
        )
        geometry_int = self._parse_constant(geometry, valid=GEOMETRIES)
        registration_int = self._parse_constant(
            kwargs.get("registration", "GMT_GRID_NODE_REG"), valid=REGISTRATIONS
        )

        # Convert dim, ranges, and inc to ctypes arrays if given (will be None
        # if not given to represent NULL pointers)
        dim = kwargs_to_ctypes_array("dim", kwargs, ctp.c_uint64 * 4)
        ranges = kwargs_to_ctypes_array("ranges", kwargs, ctp.c_double * 4)
        inc = kwargs_to_ctypes_array("inc", kwargs, ctp.c_double * 2)

        # Use a NULL pointer (None) for existing data to indicate that the
        # container should be created empty. Fill it in later using put_vector
        # and put_matrix.
        data_ptr = c_create_data(
            self.session_pointer,
            family_int,
            geometry_int,
            mode_int,
            dim,
            ranges,
            inc,
            registration_int,
            self._parse_pad(family, kwargs),
            None,