4 min read

filterWeatherForStat Documentation

Overview

This node is designed to process weather-related data and filter it based on specified attributes. This powerful tool is part of the Vantage analytics and data platform, providing users with the capability to extract relevant weather statistics from a set of weather data inputs. The logic takes in data related to weather and returns filtered information based on the selected weather attribute.

Purpose

The primary purpose of filterWeatherForStat is to filter and retrieve specific statistical data points from a collection of weather information. It allows users to focus on particular weather measurements—such as temperature, humidity, or wind—based on the needs of their analysis or reporting.

Settings

Input Parameters

  1. inputs

    • Type: Object (default: {})
    • Description: A JSON object that contains relevant input data. This can include multiple data points, including a list of weather data or specific statistics.
  2. config

    • Type: Object (default: {})
    • Description: An additional object to support deprecated input structures. If inputs is not provided, this object will be considered instead.
  3. input1

    • Type: Object (required)
    • Description: The main weather data to filter. This should be an object containing weather data which the logic can process. It could be a list of weather records or a single weather item.
  4. stat

    • Type: String (default: 'temperature')
    • Description: This setting specifies which weather statistic to filter from the input data. Acceptable values are derived from the weatherAttrMap and include attributes like 'main.temp', 'main.feels_like', etc. Changing this value determines which specific weather data attribute is returned in the output.

Output

  1. output1
    • Type: Object
    • Description: The output object containing the filtered weather statistics. It includes the specified attribute based on the provided stat and any other relevant metadata.

How It Works

Upon executing filterWeatherForStat, the function follows these steps:

  1. Input Handling: It combines provided inputs and configuration data.
  2. Stat Filtering: It checks the specified statistic to filter using the provided or default value.
  3. Data Filtering: The function utilizes the filterWeatherAttribute helper function to extract the required attribute from the weather data.
  4. Output Construction: It constructs the output object, embedding the filtered weather statistic along with any related metadata.

Data Expectations

The node expects the input1 object to contain structured weather data. This data can either be:

AI Integrations

While filterWeatherForStat does not explicitly integrate AI features in this component, it can be part of a broader analytics flow that leverages AI models for predictive analytics based on historical weather data. This integration can enhance decision-making processes in various industries, including agriculture, logistics, and disaster management.

Billing Impact

Since filterWeatherForStat processes and filters data, the consumption of resources may depend on the amount of input data and processing complexity. Users should monitor their usage patterns to ensure they stay within their Vantage billing thresholds, especially if filtering large datasets.

Use Cases & Examples

Use Cases

  1. Environmental Research: A climate research organization needs to isolate temperature readings from vast historical weather datasets to analyze the impact of climate change over time.

  2. Agricultural Decision-Making: A farming operation wants to focus on humidity levels and temperature forecasts to optimize irrigation schedules and crop health monitoring.

  3. Urban Planning: City planners require analysis of air pressure and wind data to assess how weather conditions impact air quality and urban infrastructure.

Example Configuration

Use Case: Agricultural Decision-Making

In this scenario, a farm operator uses the filterWeatherForStat logic to retrieve humidity data from their weather dataset to improve irrigation scheduling.

Sample Input Configuration

json
{
  "inputs": {
    "input1": {
      "type": "list",
      "list": [
        {
          "main": {
            "temp": 22,
            "feels_like": 21,
            "humidity": 60,
            "pressure": 1012
          },
          "weather": [{
            "description": "clear sky"
          }],
          "visibility": 10000,
          "wind": {"speed": 3.5},
          "clouds": {"all": 0}
        },
        {
          "main": {
            "temp": 25,
            "feels_like": 24,
            "humidity": 65,
            "pressure": 1010
          },
          "weather": [{
            "description": "few clouds"
          }],
          "visibility": 10000,
          "wind": {"speed": 4},
          "clouds": {"all": 5}
        }
      ]
    },
    "stat": "main.humidity"
  }
}

Expected Output

The expected output, upon executing the logic with this configuration, would provide filtered humidity data for each weather entry, resulting in an output like this:

json
{
  "output1": {
    "type": "list",
    "list": [
      {
        "humidity": 60,
        "value": 60
      },
      {
        "humidity": 65,
        "value": 65
      }
    ]
  }
}

This output facilitates targeted decision-making regarding irrigation needs based on the latest humidity data from the weather records.