Create weather metric


First, check if reference tag exists in the cluster. You will get the following error if it’s not present:

> c3Grid(WeatherStation.fetch())
tenant reference does not exist Target [reference/prod/WeatherStation?action=fetch]

Second, create weather stations by triggering the creation job with:

// create weather stations
> var job = Location.refreshWeatherStations();
> c3Grid(WeatherStationCreator.fetch({filter: Filter.eq('id',}))
// once job completed and weather stations created, refresh weather data
> WeatherDataUpdater.updateWeatherData()
// to fetch weather data
> c3Grid(Observation.fetch())

Check the weather data with a metric of the sort:

var sm = SimpleMetric.make({
    "id": "AverageDailyTemp_Facility",
    "name": "AverageDailyTemp",
    "srcType": "Facility",
    "path": "placedAt.weatherStation",
    "expression": "avg(avg(",
    "unit": {
      "id": "degrees_fahrenheit"
  ids: ['0082'],
  expressions: ['AverageDailyTemp'],
  start: '2018-10-01',
  end: '2018-11-31',
  interval: 'DAY'

To debug issues related to temperature data, check this thread WeatherDataUpdater debug