Skip to the content.

Navigation: VEAF documentation site - main page > Mission Creation Tools > veaf-tools application


🚧 WORK IN PROGRESS 🚧

The documentation is being reworked, piece by piece. In the meantime, you can browse the old documentation.


Table of Contents

Introduction

The Weather injector is part of the VEAF Tools application. Read the installation and description in the global VEAF Tools application documentation.

Using the Weather injector

The Weather injector is actually two commands of the veaf-tools application.

The inject command will inject the weather in the mission file you specify, and create a new mission file with the weather and starting conditions you specified in the command-line options.

Type veaf-tools inject --help to get help:

veaftools-inject-options

The injectall command will read a versions file containing several weather and starting conditions, and inject them in the source mission file, creating a collection of target mission files.

Type veaf-tools injectall --help to get help:

veaftools-injectall-options

Options

Mandatory command-line options

The following command-line options are mandatory for both the inject and injectall commands; don’t use the option name, they’re positional arguments (i.e., you must specify them in the order they’re listed here):

Additionally, the injectall command must have the --configuration option that points to the versions configuration file. Again, this is a positional argument, so don’t use the option name.

Example:

veaf-tools inject source.miz target.miz 

or

veaf-tools injectall source.miz target-${version}.miz versions.json

Optional command-line options

The following command-line options are optional, and are available for both the inject and injectall commands:

Common options

The injectall command eventually calls the same code as the inject command to inject the weather into a target mission file, with the options defined in each target of the configuration file.

Therefore, all the options that can be set in each target of the configuration file for the injectall command, can also be set as command-line options for the inject command.

Here are the available options, with each time the command-line option followed by the corresponding target option:

Versions file

The versions file is a JSON file that contains the weather and starting conditions you want to inject in the mission file when using the injectall command.

It contains several sections:

Each target can contain the options listed here, and must define the name of the version that will be generated with version (used to create the name of the mission file; e.g., my-mission-beforedawn-real-clear.miz from my-mission.miz).

Example of a versions file:

{
  "variableForMetar": "METAR",
  "moments": 
    {
      "onehour_tosunrise" : "sunrise-60*60",
      "late_morning" : "sunrise+120*60"
    },
  "position": 
    {
      "lat": 42.355691,
      "lon": 43.323853,
      "tz": "Asia/Tbilisi"
    },
  "targets": [
    {
      "version": "beforedawn-real-clear",
      "realweather": true,
      "clearsky": true,
      "moment": "beforedawn"
    },
    {
      "version": "beforesunrise-real",
      "realweather": true,
      "moment": "onehour_tosunrise",
      "date": "20230126"
    },
    {
      "version": "dawn-broken",
      "weatherfile": "broken-1.lua",
      "date": "202301260617"
    },
    {
      "version": "dawn-crosswind-vaziani",
      "weather": "UG27 221130Z 04515KT CAVOK Q1020 NOSIG",
      "time": "20680"
    }
  ]
}

Configuration file

The configuration file is located in the working directory of the tool, and is named configuration.json.

It will automatically be created the first time you run the tool, and contains the following sections:

An example of a configuration file:

{
  "theatres": {
    "caucasus": {
      "lat": 42.355691,
      "lon": 43.323853
    },
    "persiangulf": {
      "lat": 26.304151,
      "lon": 56.378506
    },
    "nevada": {
      "lat": 36.145615,
      "lon": -115.187618
    },
    "normandy": {
      "lat": 49.183336,
      "lon": -0.365908
    },
    "syria": {
      "lat": 32.666667,
      "lon": 35.183333
    },
    "marianaislands": {
      "lat": 14.079866,
      "lon": 145.15311411102653
    }
  },
  "checkwx_apikey": "53506465454660465040465",
  "cacheFolder": "./cache",
  "maxAgeInHours": 1
}

Injecting real world weather

This is the default if there is no METAR nor DCS weather file specified in the options.

The weather will be fetched from the closest airport to the mission theater coordinates defined in the configuration.json file.

The tool uses the CheckWX API to fetch the weather; you need to register to CheckWX and get a free API key (see here), and store it in the configuration.json file.

The fetched weather will be stored in a cache file, so that the tool doesn’t have to fetch the weather each time it runs. This is to avoid overloading the CheckWX API.

The cache location, as well as the cache expiration time, can be configured in the configuration.json file.

An example of using inject to inject real world weather:

veaf-tools inject my-mission.miz my-mission-real.miz --real

An example of using injectall to inject real world weather:

{
  "variableForMetar": "METAR",
  "position": 
    {
      "lat": 42.355691,
      "lon": 43.323853,
      "tz": "Asia/Tbilisi"
    },
  "targets": [
    {
      "version": "beforedawn-real-clear",
      "realweather": true,
      "clearsky": true,
      "moment": "beforedawn"
    },
    {
      "version": "dawn-real",
      "realweather": true,
      "moment": "dawn"
    }
  ]
}
veaf-tools injectall my-mission.miz my-mission-${version}.miz versions.json

Injecting a predefined weather

Using either a METAR or a DCS weather file, you can inject a predefined weather in the mission file.

You can extract weather definition from a DCS mission by editing the mission file that is stored inside the “.miz” file (hint: it’s a ZIP archive), and looking for the ["weather"] section. Write this section in a LUA file, and use it as the --weather parameter or the weatherFile option.

Here’s an example of a DCS weather definition:

["weather"] = {
	["atmosphere_type"] = 0,
    ["clouds"] = 
    {
        ["thickness"] = 200,
        ["density"] = 0,
        ["preset"] = "Preset13",
        ["base"] = 3400,
        ["iprecptns"] = 0,
    }, -- end of ["clouds"]
    ["cyclones"] = {
	}, -- end of ["cyclones"]
	["dust_density"] = 0,
	["enable_dust"] = false,
	["enable_fog"] = false,
	["fog"] = {
			["thickness"] = 0,
			["visibility"] = 0,
	}, -- end of ["fog"]
	["groundTurbulence"] = 26.656422237728,
	["qnh"] = 758.444,
	["season"] = {
			["temperature"] = 23.200000762939,
	}, -- end of ["season"]
	["type_weather"] = 2,
	["visibility"] = {
			["distance"] = 1593,
	}, -- end of ["visibility"]
	["wind"] = {
			["at2000"] = {
					["dir"] = 148,
					["speed"] = 10.604474819794,
			}, -- end of ["at2000"]
			["at8000"] = {
					["dir"] = 160,
					["speed"] = 12.07985101455,
			}, -- end of ["at8000"]
			["atGround"] = {
					["dir"] = 150,
					["speed"] = 4.5,
			}, -- end of ["atGround"]
	}, -- end of ["wind"]
}, -- end of ["weather"]
veaf-tools inject my-mission.miz my-mission-real.miz --weather scattered-rain.lua

Or, if using injectall:

{
  "variableForMetar": "METAR",
  "position": 
    {
      "lat": 42.355691,
      "lon": 43.323853,
      "tz": "Asia/Tbilisi"
    },
  "targets": [
    {
      "version": "dawn-broken",
      "weatherfile": "broken-1.lua",
      "moment": "dawn"
    }
  ]
}
veaf-tools injectall my-mission.miz my-mission-${version}.miz versions.json

Using a METAR is easier, as you can get it from the internet. Here’s an example:

veaf-tools inject my-mission.miz my-mission-real.miz --metar "UG27 221130Z 04515KT CAVOK Q1020 NOSIG"

Or, if using injectall:

{
  "variableForMetar": "METAR",
  "position": 
    {
      "lat": 42.355691,
      "lon": 43.323853,
      "tz": "Asia/Tbilisi"
    },
  "targets": [
    {
      "version": "dawn-crosswind-vaziani",
      "weather": "UG27 221130Z 04515KT CAVOK Q1020 NOSIG",
      "moment": "dawn"
    }
  ]
}
veaf-tools injectall my-mission.miz my-mission-${version}.miz versions.json

Contacts


Made and maintained by the Virtual European Air Force, a French DCS pilot community.

VEAF-logo Badge-Discord


If you need help or you want to suggest something, you can