numpy.unsignedinteger

Here are the examples of the python api numpy.unsignedinteger taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: polar2grid Source File: frontend_utils.py
Function: get_fill_value
    def get_fill_value(self, item, default_dtype=numpy.float32):
        """If the caller of `get_swath_data` doesn't force the output fill value then they need to know what it is now.
        Defaults version expects a 'data_type' attribute in the value returned from `file_type_info`.

            - Unsigned Integers: Highest valid integer (i.e. -1 converted to unsigned integer)
            - Signed Integers: -999
            - Float: NaN

        :raises: RuntimeError if unknown data type
        """
        data_type = self.get_data_type(item, default_dtype=default_dtype)
        if numpy.issubclass_(data_type, numpy.unsignedinteger):
            return data_type(-1)
        elif numpy.issubclass_(data_type, numpy.integer):
            return -999
        elif numpy.issubclass_(data_type, numpy.floating):
            return numpy.nan
        else:
            raise RuntimeError("Unknown data type for %s: %s" % (item, data_type))