Autodesk

Development site for Square One's software and teaching resources


WeatherTool: File Format

The Weather Tool uses its own proprietary .WEA file format, also used by all Square One products. Great I hear you say, exactly what the world needs - another proprietary binary weather file format. Given internet download times, file sizes can still be an issue. Some ASCII weather files are huge, such as the TM2 format for example, weighing in at over 1.2Meg. The WEA file comes in at 139K, stores roughly the same data and compresses down to less than 55K. It doesn’t store the same number of data validation flags, however this is not necessary for the uses to which it is put.

To load files with other formats, change the Files of Type selector in the File Open dialog.

WEA File Format

The following is an extract from a C++ header file detailing the internal data structures. The .WEA file begins with a single 16 byte identifier which should be ajm_WEA_ver1.10 immediately followed by a single byte value of zero representing a NULL string terminator. These 16 bytes are then followed by a straight binary copy of the LocationData structure described below.

#define RAINFALL		0
#define HUMIDITY_0900		1
#define HUMIDITY_1500		2
#define TEMPERATURE		3
#define TEMP_AVEMAX		4
#define TEMP_AVEMIN		5
#define TEMP_STDDEV		6
#define DAYLIGHTHOURS	 	7
#define IRRADIATION	 	8
#define DEGREEHOURS_HEAT	9
#define DEGREEHOURS_COOL	10
#define DEGREEHOURS_SOLAR	11
#define WINDSPEED_0900		12
#define WINDSPEED_1500		20
#define WEATHERDATASIZE		28

#define SIZE_32BYTES		32
#define MONTHS			12
#define HOURS			24

struct HourlyData {
	short int temp;  	// °C/10.
	short int humidity;	// % (0 -> 100).
	short int wind;		// km/h.
	short int direction;	// Deg. CW fm North.
	short int diffuse;	// Wh.
	short int direct; 	// Wh.
	short int cloud;	// %.
	short int rain;		// mm.
	};

struct LocationData  {
	char name[SIZE_32BYTES];
	char where[SIZE_32BYTES];
	HourlyData hourly[365][HOURS];
	int monthly[WEATHERDATASIZE][MONTHS];
	float longitude;
	float timezone;
	float latitude;
	float altitude;
	int day;
	int sky;
	};

Note that all temperature values are stored as tenths of a degree, so you will need to divide by 10 after reading and multiply by 10 before saving.

WeatherTool: Tutorial CSV
Weather Data Files

HOW WOULD YOU RATE THIS PAGE/DEFINITION ?

No votes yet