JAXA Earth API for JavaScript
    Preparing search index...

    Function compute

    • Performs an operation using multiple DataObjects and returns a new DataObject.

      Parameters

      • __namedParameters: {
            dataObjects: DataObject[];
            operation: (...values: number[]) => number;
            unit: string;
            date?: Date;
            formattedDate?: string;
        }
        • dataObjects: DataObject[]

          Specifies the DataObjects used in the operation as an array.

        • operation: (...values: number[]) => number

          Specifies the per-pixel computation method.

        • unit: string

          Specifies the unit of the value after the operation.

        • Optionaldate?: Date

          If the DataObject after the operation has a concept of date and time, specifies that date and time. If not specified, it becomes undefined.

        • OptionalformattedDate?: string

          If the DataObject after the operation has a concept of date and time, specifies the string representation of that date and time. If not specified, it becomes undefined.

      Returns DataObject

      // Convert data in Kelvin units to data in degC units
      const dataObject2 = je.data.compute({
      dataObjects: [dataObject],
      operation: (value) => value - 273.15,
      unit: "degC",
      date: dataObject.data,
      formattedDate: dataObject.formattedDate,
      });

      // Compute the anomaly from the observed value dataObject1 and the climatological normal value dataObject2
      const anomaly = je.data.compute({
      dataObjects: [dataObject1, dataObject2],

      // Define the computation method between pixels (the arguments are in the same order as the dataObjects array)
      operation: (value_of_dataObject1, value_of_dataObject2) => value_of_dataObject1 - value_of_dataObject2,

      unit: "degC",
      date: dataObject1.data,
      formattedDate: dataObject1.formattedDate,
      });