#ifndef BMSD_DEFS #define BMSD_DEFS
// is defined in MeteoToolsDefs.h // #define USHORT unsigned short // #define UBYTE unsigned char
#pragma pack(1) #include <afxtempl.h> ///////////////////////////////////////////////////////// // BMSD = Bonito Meteo Server Data // more info find you on www.meteoserver.det/devolpment ///////////////////////////////////////////////////////// //the whole world coordinates //360 x 181 ... note: from top to bottom is everytime plus one #define WRL_L -10800 // 180W #define WRL_R 10800 // 180E in reality 10740 (179E), because 180W is also equal to 180E #define WRL_T -5400 // 90N #define WRL_B 5400 // 90S #define WRL_RES 60 // 1° //81 x 61 ... note: from top to bottom is everytime plus one // and ...... the last one, if not the whole world ... europe is not a globe #define EUR_L -2400 // 40W #define EUR_R 2400 // 40E #define EUR_T -4800 // 80N #define EUR_B -1200 // 20N #define EUR_RES 60 // 1° //121 x 71 E-USA,CAN Caribian, Atlantic and W-Europa #define MID_L -6000 // 100W #define MID_R 1200 // 20E #define MID_T -4800 // 80N #define MID_B -600 // 10N #define MID_RES 60 // 1° //101 x 91 USA,CAN Caribian and Atlantic... #define USA_L -8400 // 140W #define USA_R -2400 // 40W #define USA_T -4800 // 80N #define USA_B 600 // 10S #define USA_RES 60 // 1° //101 x 91 INDIAN OCEAN... #define IND_L 1200 // 20E #define IND_R 7200 // 120E #define IND_T -1800 // 30N #define IND_B 3600 // 60S #define IND_RES 60 // 1° //101 x 81 JAPAN,CHINA,INDONESIA,N-AUSTRALIA... #define EST_L 4800 // 80E #define EST_R 10800 // 180E #define EST_T -3600 // 60N #define EST_B 1200 // 20S #define EST_RES 60 // 1° //80 x 111 AFRICA, INDIAN OCEAN... #define AFR_L -1200 // 20W #define AFR_R 3600 // 60E #define AFR_T -2400 // 40N #define AFR_B 3600 // 60S #define AFR_RES 60 // 1° //101 x 81 AUSTRALIA, INDONESIA... #define AUS_L 4800 // 80E #define AUS_R 10800 // 180E #define AUS_T -1200 // 20N #define AUS_B 3600 // 60S #define AUS_RES 60 // 1° #define REG_USR 0 #define REG_WRL 1 #define REG_EUR 2 #define REG_MID 3 #define REG_USA 4 #define REG_EST 5 #define REG_AFR 6 #define REG_IND 7 #define REG_AUS 8 #define MAX_REG 8 /* ///////////////////////////////////////////////////////// //file system syntax YYMMDDHHMMhhhname.ext ^^--^^--^^---^^^^.^^^ { YY = year MM = month DD = day HH = hour = t = forcast basis time 00:00, 06:00, 12:00, 18:00 MM = minute hhh= part of forcast hours 000-180-384 p.e. 2004 7.Dec 06:00 forcast for part 99 hours = 0412070600099BMSD_SEA.zip if hhh == minus (-72 .... -03) then is this a anlyse of the last days / hours course-end the analysis was completed with synop data p.e. the weather, 72 hours before the 2004 16.Dec 18:00 = 0412161800-72BMSD_SFC.dat = } name.ext - curred file names, we have in use --------------------------------------------- .zip = compressed data file (pkzip) //gfs orignal ....GFSSFC.dat = the whole world data set of BMSD_SFC struct grid resulution = 1° x 1° ....GFSSEA.dat = the whole world data set of BMSD_SEA struct grid resulution = 1° x 1°25 ....GFSSFC_EUR.dat = europe data set of BMSD_SFC struct grid resulution = 1° x 1° ....GFSSEA_EUR.dat = europe data set of BMSD_SEA struct grid resulution = 1° x 1°25 //the bonitistic geometry model BGM //(see -> germany 1976, 1987, 2002, 2004 "theoretische Physik - Peter Walter") ....BMSD_WRL.dat = the whole world data set of BMSD_SFC+BMSD_SEA struct grid resulution = .°25° x .25° ....BMSD_EUR.dat = europe data set of BMSD_SFC+BMSD_SEA struct grid resulution = .°25° x .25° ....BMSD_WST.dat = WEST_.... data set of BMSD_SFC+BMSD_SEA struct grid resulution = .°25° x .25° ....BMSD_EST.dat = EAST_.... data set of BMSD_SFC+BMSD_SEA struct grid resulution = .°25° x .25° */ ///////////////////////////////////////////////////////// //flags for type of precipitation and land and ice cover #define FRC_ICEC 1 #define FRC_RAIN 2 #define FRC_FRZR 4 #define FRC_ICEP 8 #define FRC_SNOW 16 #define FRC_LAND 32 //synop wind is valid #define FRC_VALID 128 //data is valid ////////////////////////////////////////////// //ValidFalgs indicate the valid surface data #define BMS_PRMSL (0x00000001) // 0:pressure #define BMS_TMP (0x00000002) // 1:temperature (2m level) #define BMS_WIND (0x00000004) // 2:wind #define BMS_WDIR (0x00000008) // 3:wind direction #define BMS_TCDC (0x00000010) // 4:convective clouds #define BMS_APCP (0x00000020) // 5:Precipitation value #define BMS_RH (0x00000040) // 6:relative humidity #define BMS_PFLAGS (0x00000080) // 7:type of precipitation flags #define BMS_BTCDC (0x00000100) // 8:boundary cloads #define BMS_WEASD (0x00000200) // 9:Snow depth #define BMS_WTMP (0x00000400) // 10:water temperature (surface level) #define BMS_SFCMASK (0x00000FFF) //#define BMS_ (0x00000800) //11: //#define BMS_ (0x00001000) //12: //#define BMS_ (0x00002000) //13: //#define BMS_ (0x00004000) //14: //#define BMS_ (0x00008000) //15: //#define BMS_ (0x00010000) //16: #define BMS_HTSGW (0x00020000) //17:Sig height of wind waves and swell #define BMS_WVPER (0x00040000) //18:Mean period of wind waves #define BMS_WVDIR (0x00080000) //19:Direction of wind waves #define BMS_PERPW (0x00100000) //20:Primary wave mean period #define BMS_DIRPW (0x00200000) //21:Primary wave direction #define BMS_PERSW (0x00400000) //22:Secondary wave mean period #define BMS_DIRSW (0x00800000) //23:Secondary wave direction #define BMS_BMSDATA (0x80000000) //32:flag say: this is a synop mesoscale point #define BMS_SEAMASK (0x00FF0000) ///////////////////////////////////////////////////////// // structures surface data ///////////////////// ///////////////////////////////////////////////////////// //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // the data are writen von left/top to bottom/right // the world cordinates system that Bonito use: // // in minutes = 180W to 180E --> -10800 to 10800 // 90N to 90S --> -5400 to -5400 // // xmin, xmax, ymin, ymax contain such value //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! typedef struct { //BMSD_FH = Bonito Meteo Server Data file header char bmsd[4]; //='BMSD' file id BYTE vers:4; //the first 4 bits = version of BMSD BYTE comptype:4; //the last 4 bits = type of data value compression //the count order commes froms the validflags-order //comptype = 0 = complet dataset per point // 1 = each value have a feld of (xres * yres * layermax) // 1 = you can extrem better compress //boundary coordinates window in Minutes BYTE xres; //x resolution in minutes (p.e. 60=1°) max =255 =~4°26 BYTE yres; //y resolution in minutes (p.e. 60=1°) max =255 =~4°26 short left; //left/top corner - lon of the first dataset short top; //left/top corner - lat of the first dataset short right; //right/bottom corner - lon of the last dataset short bottom; //right/bottom corner - lat of the last dataset UINT validflags; //valid data types (insite of this BMSD-Package) max 32 Flags time_t validtime; //valid times (UTC) of this forcast sequence //validtime is in seconds elapsed since midnight (00:00:00), January 1, 1970 USHORT layermax; //maximum of the layers (time steps) USHORT stepswidth; //time step width in minutes //or 0x1000=Synop have original messure data // 0x1001=Synop InterSec1 contains data -->0x1000-file // 0x1002=Synop InterSec2 contains data -->0x1000-file char reserve[5]; //reserve for expasions or your own flags }BMSD_FH; typedef struct {//BMSD = Bonito Meteo Server Data BMSD_SFC+BMSD_SEA USHORT prmsl; //PRMSL 0.1 of Pressure [hPa] +900.0 hPa short temp; //TMP 0.1 of Temperature [C] (2m level) short wtemp; //WTMP 0.1 of Water Temperature [C] (surface level) union { USHORT wind; //WIND 0.1 of Wind speed [m/s] (p.ex. used by MeteoTools GetDataOfPoint) short ugrd; //vector-U value of wind (10m Level) }; union { USHORT wdir; //WDIR 0.1 of Wind direction [deg] (p.ex. used by MeteoTools GetDataOfPoint) short vgrd; //vector-V value of wind (10m Level) }; BYTE btcdc; //BTCDC Boundary cloud layer total cloud cover [%] BYTE tcdc; //TCDC Convective cloud layer total cloud cover [%] BYTE rh; //RH Relative humidity [%] BYTE pflag; //flags type of precipitation and land and ice cover (see FRC_ICEC,FRC_RAIN.....) //BIT-0 ICEC Ice cover (ice=1, no ice=0) //BIT-1 CRAIN 3 hr average Categorical rain (yes=1; no=0) [non-dim] //BIT-2 CFRZR 3 hr average Categorical freezing rain (yes=1; no=0) [non-dim] //BIT-3 CICEP 3 hr average Categorical ice pellets (yes=1; no=0) [non-dim] //BIT-4 CSNOW 3 hr average Categorical snow (yes=1; no=0) [non-dim] USHORT weasd; //WEASD 0.1 of equivalent of accumulated snow depth [kg/m^2] USHORT acpt; //ACPT 0.1 of precipitation [kg/m^2] USHORT htsgw; //HTSGW 0.1 of Sig height of wind waves and swell [m] USHORT wvper; //WVPER 0.1 of Mean period of wind waves [s] USHORT wvdir; //WVDIR 0.1 of Direction of wind waves [deg] USHORT perpw; //PERPW 0.1 of Primary wave mean period [s] USHORT dirpw; //DIRPW 0.1 of Primary wave direction [deg] USHORT persw; //PERSW 0.1 of Secondary wave mean period [s] USHORT dirsw; //DIRSW 0.1 of Secondary wave direction [deg] }BMSDATA_SET; typedef CArray<BMSDATA_SET,BMSDATA_SET&> BMSDataSet; //////////////////////////////////////////////////////////////////////////////////////////// // download service definitions /* // for download we use a cluster files without header // only the file names indicated the necessary informations // the download cluster files are packets for 20° x 10° and are 8 x 3 hour long = 24 hour = 1 day // one cluster use a range of 20°LON and 10°LAT = 20 x-points 0°-->19°LON and 10 y-lines 0°-->9° // .... 20 x-points 20°-->39°LON and 10 y-lines 10°-->19° ..... // for better compressing is each values a single field of data type // it exist 3 block types, but the structures BMSD_CLUST_1,2,3 refers only to the row sequence of the data types // in the cluster file all is saved like follows: // 200 PRMSL x 8 for each 3 hours step, = 1600 values // then 200 TEMP x 8 for each 3 hours .................. // .....1600 UGRD, 1600 VGRD // .... and the last - are 1600 HTSGW's //--------------------------------------------------------------- //the file syntax for a cluster is: YYMMDDHHpcccdDNLrs.msd //--------------------------------------------------------------- each 6 hours we refresh the files - availability: approximately t+6 Hours type of file: ziped binary data file { YY = year MM = month DD = day HH = hour = meassure time p = 1-3 packet nomber = 1. 2. or 3.packet BMSD_PACK_? ccc = 0-323 cluster nomber = 18 x 18 = 324 cluster nombers cluster 0=180W,90N ... 323=180E,90S d = 1-7 the nomber of the forcast day = 7 days forecast DNL = identify rs = resolution in minutes 0.25°= 15 1°=60 p.e. 1.packet, cluster location 80°N / 140°W for data from 2005 14.Feb 6:00 with 1° resolution and the 2.day of forecast = 0502140610502FRC60.msd } typedef struct {//BMSD = Bonito Meteo Server compressed data 1.packet USHORT prmsl; //PRMSL 0.1 of Pressure [hPa] +900.0 hPa short temp; //TMP 0.1 of Temperature [C] (2m level) short ugrd; //vector-U value of wind (10m Level) short vgrd; //vector-V value of wind (10m Level) BYTE tcdc; //Boundary cloud layer total cloud cover [%] BYTE pflag; //flags type of precipitation and land and ice cover (see FRC_ICEC,FRC_RAIN.....) //BIT-0 ICEC Ice cover (ice=1, no ice=0) //BIT-1 CRAIN 3 hr average Categorical rain (yes=1; no=0) [non-dim] //BIT-2 CFRZR 3 hr average Categorical freezing rain (yes=1; no=0) [non-dim] //BIT-3 CICEP 3 hr average Categorical ice pellets (yes=1; no=0) [non-dim] //BIT-4 CSNOW 3 hr average Categorical snow (yes=1; no=0) [non-dim] USHORT acpt; //ACPT 0.1 of precipitation [kg/m^2] USHORT htsgw; //HTSGW 0.1 of Sig height of wind waves and swell [m] } BMSD_PACK_1; typedef struct {//BMSD = Bonito Meteo Server compressed data 2.packet short wtemp; //WTMP 0.1 of Water Temperature [C] (surface level) BYTE rh; //RH Relative humidity [%] BYTE tcdc; //tcdc TCDC of Convective cloud layer total cloud cover [%] USHORT wvper; //WVPER 0.1 of Mean period of wind waves [s] USHORT wvdir; //WVDIR 0.1 of Direction of wind waves [deg] USHORT perpw; //PERPW 0.1 of Primary wave mean period [s] USHORT dirpw; //DIRPW 0.1 of Primary wave direction [deg] USHORT persw; //PERSW 0.1 of Secondary wave mean period [s] USHORT dirsw; //DIRSW 0.1 of Secondary wave direction [deg] USHORT weasd; //WEASD 0.1 of equivalent of accumulated snow depth [kg/m^2] } BMSD_PACK_2; //////////////////////////////////////////////////////////////////////////////////////////// // download service definitions for synoptic data // for download of synop data we use a cluster files without header // only the file names indicated the necessary informations // the download cluster files are packets for 20° x 40° per 3 hour seqence // one cluster use a range of 40°LON and 20°LAT // each struct have a direct coordinate = SYNOP-Point (lon.lat) //--------------------------------------------------------------- //the file syntax for a cluster is: YYMMDDHHccSYNOP.msd //--------------------------------------------------------------- typedef struct { //BMSYND = Bonito Meteo Server compressed Synop Data packet int ValidFalgs; //what is available - what is in fact valid short lat; //Position Latitude in Minutes short lon; //Position Longitude in Minutes BMSDATA_SET data; SYN_STATION station; //data of the SynopStation }BMSD_SYN; */ //////////////////////////////////////////////////////////////////////////////////////////// //line definitions - like isobar,isoterm //type: the plane type of lines of a poligon #define PLANE_PRESS 0 //= isobar of pressure #define PLANE_TERM 1 //= isotherm of air temperature #define PLANE_HTSGW 2 //= height of wind waves and swell #define PLANE_PRCPT 3 //= precipitation #define PLANE_SNOW 4 //= snow coverage #define PLANE_CLOUDS 5 //= boundary clouds #define PLANE_RH 6 //= relative humidity #define PLANE_WTERM 7 //= isotherm of water temperature #define PLANE_ICE 8 //= ice coverage #define PLANE_CCLOUDS 9 //= convective clouds #define PLANE_WIND 10 //= non line, wind speed and direction field (only color plane) #define PLANE_BATHY 11 //bathymetry colors of the sea #define MAX_PLANES 10 //the maximum of line planes (struct ISOPLANE type max) #define PLANE_MAXTYPE 11 //the maximum of all plane types #define PLANE_PRCPT_CLOUDS 99 //quasi rain-coulds of precipitation couver #define COOR_MAX short(32767) //used as start x-ymax initital #define COOR_MIN short(-32766) //used as start x-ymin initital //cltyp: closing type of line (close clockwise) #define CLTYPE_II 0 //polygone normal close, polygone is inside #define CLTYPE_ST 0x01 //start on top #define CLTYPE_SR 0x02 //start on right #define CLTYPE_SB 0x04 //start on bottom #define CLTYPE_SL 0x08 //start on left #define CLTYPE_SF 0x0F //all starts #define CLTYPE_ET 0x10 //end on top #define CLTYPE_ER 0x20 //end on right #define CLTYPE_EB 0x40 //end on bottom #define CLTYPE_EL 0x80 //end on left #define CLTYPE_EF 0xF0 //all ends #define CLTYPE_TT 0x11 //end on top #define CLTYPE_RR 0x22 //end on right #define CLTYPE_BB 0x44 //end on bottom #define CLTYPE_LL 0x88 //end on left #define CLTYPE_FF 0x1000 // !!! only lines - non polygones - no sorted hierarchy --like PLANE_HTSGW-Lines // but, this line type include all the other CLTYPE atributes marker also #define CLTYPE_LEFTDRIVE 0x8000 //0=clockwise line drive, otherwise ----> 0x8000 = is not clockwise #define CLTYPE_CLOCKWISE 0x00FF //my lines use a coordinates system Lon/Lat in minutes //top/left = -5400, -10800 //bottom/right = +5400, +10800 //plane / layer pointer array typedef struct { int type; //the line type of this plane / layer (PLANE_PRESS,PLANE_TERM...) int width; //value width for one step = step width of the lines int min; //minimum value - from int max; //maximum value - to int start; //the pointer to the beginn of the LineArray int len; //count of all the lines in this plane / layer } ISOPLANE; //line pointer array - each lines allways a closed poligone it is typedef struct { USHORT type; //the line type (PLANE_PRESS,PLANE_TERM...) USHORT cltyp; //closing type of line USHORT value; //the value, the color of the layer of the poligone int insideof; //line nomber of the Outside-Poligon (used by sort help) //0xFFFFFFFF == has no Outside-Poligon int start; //the pointer to the beginn of the Coordinates int len; //count of all the points in this line short xmin; //TOP-X-Position for the frame rectangle of the polygone short xmax; //BOT-X-Position short ymin; //TOP-Y-Position short ymax; //BOT-Y-Position } ISOLINES; //the file header of ISOPLANE's, ISOLINES's and the Coordinates typedef struct { char bmsd[4]; //='BMSL' file id BYTE vers:4; //the first 4 bits = version of BMSD BYTE comptype:4; //the last 4 bits = type of data value compression BYTE xres; //x resolution in minutes (p.e. 60=1°) max =255 =~4°26 BYTE yres; //y resolution in minutes (p.e. 60=1°) max =255 =~4°26 short left; //left/top corner - lon short top; //left/top corner - lat short right; //right/bottom corner - lon short bottom; //right/bottom corner - lat time_t validtime; //valid times (UTC) of the BMSD-File int planes; //amount of ISOPLANE's; int lines; //amount of ISOLINES's int points; //amount of the points of the Coordinates // it follow then.... // IsoPlane = ISOPLANE-Array // IsoLines = ISOLINES-Array // all points = Coordinates } BMSL_FH; typedef CArray<ISOPLANE,ISOPLANE&> IsoPlane; typedef CArray<ISOLINES,ISOLINES&> IsoLines;
/* typedef struct tagPOINT { LONG x; LONG y; } POINT; */ typedef struct { short x; short y; } COORDIANTE; typedef CArray<COORDIANTE,COORDIANTE&> Coordinates; ////////////////////////////////////////////////////////////// //diverse pointer arrays for the exist forcast file management //note: !!! the basis time have +6 hours offset typedef struct { int type; //the type of this M eteo S erver D ata-File 0=SYNOP-File 1=FORECAST-File 2=EmailBulletin time_t validtime; //valid time & date of this file in the meteodata directory int stepswidth; //value of steps in this reference sequence int region; //the region = REG_WRL,REG_EUR,REG_MID.... -1 = user definition in xmin,ymin.... int validflags; //flag of the data header = valid data types (insite of a BMSD-Package) int left; //left/top corner - lon of the first dataset int top; //left/top corner - lat of the first dataset int right; //right/bottom corner - lon of the last dataset int bottom; //right/bottom corner - lat of the last dataset char regstr[4]; //region short name //is set only by EmailBulletin int hour; //forecast hour //is set only by the user int selected_hour; //I need this as my last used hour int flag; //free for your own settings }MSDFILE; typedef CArray<MSDFILE,MSDFILE&> MSDFile; //for EmailBulletin //MeteoPack data valid flags #define RBMS_PRMSL (0x0001) #define RBMS_TMP (0x0002) #define RBMS_WIND (0x0004) //UGRD #define RBMS_WDIR (0x0008) //VGRD #define RBMS_HTSGW (0x0010) #define RBMS_APCP (0x0020) #define RBMS_WVDIR (0x0040) #define RBMS_PFLAGS (0x0080) #define RBMS_BTCDC (0x0100) //MeteoPack Detail-No. #define MP_DETAIL_PRESS 0 //A 1/3 of 0.1 hPa Pressure 900.0 + value * 3 #define MP_DETAIL_TEMP 1 //B 0.1 °C Temperature +/-64° -64 + value #define MP_DETAIL_UGRD 2 //C 0.1 wind vector u Table #define MP_DETAIL_VGRD 3 //D 0.1 wind vector v Table #define MP_DETAIL_CLOUDS 4 //E % Boundary cloud layer 0-100% #define MP_DETAIL_PRECI 5 //F 0.1 [kg/m^2] Precipitation Table #define MP_DETAIL_PFLAGS 6 //G Flags FRC_RAIN=2, FRC_FRZR=4, FRC_ICEP=5, FRC_SNOW=6; FRC_ICEC +=10 #define MP_DETAIL_HTSGW 7 //H 0.1 m wave height #define MP_DETAIL_WVDIR 8 //I 1/6 of 0.1° wave direction #pragma pack() #endif //BMSD_DEFS