Loading ...
Sorry, an error occurred while loading the content.

HW Pro and HW Beta 2.0 history file formats for programmers.

Expand Messages
  • wuhu_software
    Here is the format of the history.dat file that is output by WUHU. This matches the file format output by the Heavyweather Pro application. The HW Pro
    Message 1 of 7 , Nov 2, 2008
    View Source
    • 0 Attachment
      Here is the format of the history.dat file that is output by WUHU. This
      matches the file format output by the Heavyweather Pro application. The
      HW Pro application supports WS-36XX stations. We use the HW Pro
      application to graph the history files output by WUHU.

      This format was chosen because it contains more fields than the old HW
      Beta 2.0 format.

      New records are added to the end of the file, there is no header or
      trailing record.

      The [X] field denotes the number of bytes in the field.

      00 Double [8] Timestamp days from 12/30/1899 00:00:00
      (GMT)
      08 Float [4] Abs Pressure hectopascals (millibars)
      12 Float [4] Relative Pressure hectopascals (millibars)
      16 Float [4] Wind Speed meters/second
      20 ULong [4] Wind Direction see below
      24 Float [4] Wind Gust meters/second
      28 Float [4] Total Rainfall millimeters
      32 Float [4] New Rainfall millimeters
      36 Float [4] Indoor Temp celsius
      40 Float [4] Outdoor Temp celsius
      44 Float [4] Indoor Humidity %
      48 Float [4] Outdoor Humidity %
      52 ULong [4] unknown - (Value is always 0)

      Wind Direction

      Wind direction is encoded as an integer between 0 and 15. To get the
      wind direction in degrees, multiply the value by 22.5. To get compass
      directions (moving clockwise) 0 is North, 1 is North-Northeast, 2 is
      Northeast, etc...

      0 N
      1 NNE
      2 NE
      3 ENE
      4 E
      5 ESE
      6 SE
      7 SSE
      8 S
      9 SSW
      10 SW
      11 WSW
      12 W
      13 WNW
      14 NW
      15 NNW

      C data structure that mimics this format:

      struct WeatherRecord3600 {
      double fTimeStamp;
      float fOutdoorAbsolutePressure;
      float fOutdoorRelativePressure;
      float fOutdoorWindSpeed;
      unsigned long ulOutdoorWindDirection;
      float fOutdoorWindGust;
      float fOutdoorTotalRainfall;
      float fOutdoorNewRainfall;
      float fIndoorTemperature;
      float fOutdoorTemperature;
      float fIndoorHumidity;
      float fOutdoorHumidity;
      unsigned long ulUnknown;
      };

      The fTimeStamp is an odd field. It represents the days since a epoch
      time (12/30/1899 00:00:00) in UTC local time. The fractional part is
      used to obtain hours, minutes, and seconds. There are a few functions
      that are needed to convert back and forth between that timestamp format
      and the normal local time format, they are given below.

      To convert from a normal time_t to this format you would use:

      time_t t;
      WeatherRecord3600 wr3600;

      wr3600.fTimeStamp=Convert_time_t_To_DateTime2(ConvertLocalToUTCLocal(t))\
      ;

      To convert from this odd timestamp to a time_t:

      t=ConvertUTCLocalToLocal(Convert_DateTime2_To_time_t(wr3600.fTimeStamp))\
      ;

      -----------------------

      double Convert_time_t_To_DateTime2(time_t vtime_t)

      {
      double fresult;
      // 25569 days from Saturday, December 30, 1899 to Sunday, January 1,
      1970 (where time_t seconds counts from)
      double fDeltaDays = 25569 + (vtime_t / (60 * 60 * 24));
      double fFractionDays = (vtime_t % (60 * 60 * 24)) / (double)(60 * 60 *
      24);
      fresult = fDeltaDays+fFractionDays;
      return (fresult);
      }

      //----

      time_t Convert_DateTime2_To_time_t(double fTime)

      {
      return (time_t)((fTime - 25569.0) * 86400.0);
      }

      //----

      time_t ConvertUTCLocalToLocal(time_t t)

      {
      // Aquire a local time and a gmt time.
      struct tm tm_localtime;
      memcpy(&tm_localtime,localtime(&t),sizeof(tm_localtime));

      // Aquire UTC time.
      struct tm tm_gmtime;
      memcpy(&tm_gmtime,gmtime(&t),sizeof(tm_gmtime));

      // Convert them back to time_t types.
      time_t t1=mktime(&tm_localtime);
      time_t t2=mktime(&tm_gmtime);

      // Subtract from local time the difference between local time and gmt
      time.
      t1 += (t2-t1);

      // If daylight saving time in effect, subtract an hour.
      if (tm_localtime.tm_isdst)
      t1 -= 60*60;

      return(t1);
      }

      //----

      time_t ConvertLocalToUTCLocal(time_t t)

      {
      // Aquire a local time and a gmt time.
      struct tm tm_localtime;
      memcpy(&tm_localtime,localtime(&t),sizeof(tm_localtime));

      // Aquire UTC time.
      struct tm tm_gmtime;
      memcpy(&tm_gmtime,gmtime(&t),sizeof(tm_gmtime));

      // Convert them back to time_t types.
      time_t t1=mktime(&tm_localtime);
      time_t t2=mktime(&tm_gmtime);

      // Subtract from local time the difference between local time and gmt
      time.
      t1 -= (t2-t1);

      // If daylight saving time in effect, add an hour.
      if (tm_localtime.tm_isdst)
      t1 += 60*60;

      return(t1);
      }

      ---------------------------------

      For completeness sake, here is the HW Beta 2.0 format. As you can see
      the data set is not complete. There is for example no relative pressure.
      That would have to be determined by either reading the relative pressure
      from the console or by prompting the user for an offset from the abolute
      pressure.

      Source: http://www.niftythings.org/HeavyWeather%20History%20Format.txt

      HeavyWeather V2.0 beta La Crosse WS-2310 and WS-2315 weather stations

      Each row of data is stored in 36 byte chunks starting from the beginning
      of the file (no header).

      Row
      Offset Type Name Unit
      ------ --------- ---------------- -----
      00 ULong [4] unknown - (Value is always 1)
      04 ULong [4] Timestamp seconds from 1/1/1900 00:00:00
      (GMT)
      08 Float [4] Abs Pressure hectopascals (millibars)
      12 Float [4] Wind Speed meters/second
      16 ULong [4] Wind Direction see below
      20 Float [4] Total Rainfall millimeters
      24 Float [4] Indoor Temp Celsius
      28 Float [4] Outdoor Temp Celsius
      32 UWord [2] Indoor Humidity %
      34 UWord [2] Outdoor Humidity %

      At the end of the file is an additional 28 bytes providing information
      about the dataset as a whole.

      Offset Type Description
      ------ --------- ----------------
      00 ULong [4] unknown
      04 Ulong [4] unknown (0)
      08 Float [4] unknown (5.698)
      12 ULong [4] unknown (0)
      16 ULong [4] Number of rows
      20 ULong [4] Timestamp of the first row of data
      24 ULong [4] Timestamp of the last row of data
    • wuhu_software
      Tom, I have re-enabled the windchill field. Try this version: WUHU216_32_B63.zip
      Message 2 of 7 , Nov 2, 2008
      View Source
      • 0 Attachment
        Tom,

        I have re-enabled the windchill field.

        Try this version:

        WUHU216_32_B63.zip 


        --- In wuhu_software_group@yahoogroups.com, "Tom Swift" <egore2003@...> wrote:
        >
        > > If you can use VB to read binary files, I can supply the file
        > format.
        > Thats not a bad idea concidering I have to have this program running.
        > Would still like to have DLL capabilitys to. Let me know what you
        > figure out about the wind string.
        >
        > --- In wuhu_software_group@yahoogroups.com, "wuhu_software"
        > wuhu_software@ wrote:
        > >
        > >
        > > I cannot recall why I pulled windchill from the string.
        > >
        > > We can re-enable it and see.
        > >
        > > As far as a DLL goes, I am sure we could do something.
        > >
        > > If you can use VB to read binary files, I can supply the file
        > format.
        > >
        > >
        > > --- In wuhu_software_group@yahoogroups.com, "Tom Swift"
        > > <egore2003@> wrote:
        > > >
        > > > You asked about needed features. Using WUHU with the WS-2310 I
        > > > noticed the XML feed coming from my uploaded station data at
        > > > Underground was missing the data from the windchill_string
        > field. I
        > > > tried using the tweak even and still couldn't get any data to
        > post
        > > > for windchill. I also tossed this code together for the
        > Underground
        > > > station chart last night. Its real basic but I figured I would
        > share
        > > > it with you and the group.
        > > >
        > > > <script language="JavaScript">
        > > > d = new Date();
        > > > var mday = d.getDate();
        > > > var myear = d.getFullYear();
        > > > var mmonth = d.getMonth() + 1;
        > > > document.writeln('<img src="http://www.wunderground.com/cgi-
        > > > bin/wxStationGraphAll?
        > > >
        > day='+mday+'&year='+myear+'&month='+mmonth+'&ID=KAZAPACH11&type=3&wid
        > > >
        > th=500&showtemp=1&showpressure=1&showwind=1&showwinddir=1&showrain=1"
        > > > alt="KAZAPACH11 Weather Graph" id="wxHistoryImage" />')
        > > > </script>
        > > >
        > > > Working example:
        > > > http://www.tas-independent-
        > programming.com/UndergroundGridDisp.htm
        > > >
        > > > Thomas A. Swift
        > > > Programmer & Webmaster of
        > > > TAS Independent Programming
        > > > http://www.tas-independent-programming.com
        > > >
        > >
        >
      • Thomas Swift
        Hi Larry Been real buisy latly. In september I upgraded my ham ticket to Tech. Early october made $400 off EBay and bought a like new Kenwood TS-140S off EBay.
        Message 3 of 7 , Nov 2, 2008
        View Source
        • 0 Attachment

          Hi Larry
          Been real buisy latly. In september I upgraded my ham ticket to Tech. Early october made $400 off EBay and bought a like new Kenwood TS-140S off EBay. Now I managed to get and fix this LaCross WS-2310 off EBay and get it fixed. Hoping this next spring to make a Skywarn spotter class and get my spotter ID finaly. I have a Kenwood TH-75A I picked up in a local goodwill last march for $5. It was a heck of a find. So im compleatly outfitted for both HF,VHF & UHF now. As well as having proper weather observation equipment. Thinking of getting one of those hand held anometers with temp ect. next for feild use. I decided to get involved with Skywarn almost 6 years ago and just now finaly getting all the necisary licencing and equipment gatherd together. So it feels real nice getting this second to final peice of the puzzle put into place. Still have to get that spotter ID. But its the last peice I need. EBay has been a real blessing to me. Finaly able to take the gatherd stuff I do find and sell it for the money for the stuff I realy need.


          Thomas A. Swift
          Programmer & Webmaster of
          TAS Independent Programming
          http://www.tas-independent-programming.com
          Less Bush, More Trees! http://www.greenpeaceusa.org

          -- "Larry Myers" <hometownnerd@...> wrote:

          Hey Thomas, aren't you a member of planetsourcecode? Just thought I would say Hi and fancy seeing you here

          Have a good day,
          Larry

          On Sat, Nov 1, 2008 at 6:04 PM, wuhu_software <wuhu_software@ yahoo.com> wrote:


          I cannot recall why I pulled windchill from the string.

          We can re-enable it and see.

          As far as a DLL goes, I am sure we could do something.

          If you can use VB to read binary files, I can supply the file format.

          --- In wuhu_software_ group@yahoogroup s.com, "Tom Swift"
          <egore2003@.. .> wrote:
          >
          > You asked about needed features. Using WUHU with the WS-2310 I
          > noticed the XML feed coming from my uploaded station data at
          > Underground was missing the data from the windchill_string field. I
          > tried using the tweak even and still couldn't get any data to post
          > for windchill. I also tossed this code together for the Underground
          > station chart last night. Its real basic but I figured I would share
          > it with you and the group.
          >
          > <script language="JavaScript">
          > d = new Date();
          > var mday = d.getDate();
          > var myear = d.getFullYear( );
          > var mmonth = d.getMonth() + 1;
          > document.writeln('<img src="http://www.wundergr ound.com/ cgi-
          > bin/wxStationGraphA ll?
          > day='+mday+'&year='+myear+'&month='+mmonth+'&ID=KAZAPACH11&type=3&wid
          > th=500&showtemp=1&showpressure= 1&showwind=1&showwinddir= 1&showrain=1"
          > alt="KAZAPACH11 Weather Graph" id="wxHistoryImage" />')
          > </script>
          >
          > Working example:
          > http://www.tas- independent- programming. com/UndergroundG ridDisp.htm
          >
          > Thomas A. Swift
          > Programmer & Webmaster of
          > TAS Independent Programming
          > http://www.tas- independent- programming. com
          >




          _____________________________________________________________
          Click for free info on college degrees.
        Your message has been successfully submitted and would be delivered to recipients shortly.