April 29, 2024, 10:50:10 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Doppler radar display

Started by Ionic Wind Support Team, June 09, 2006, 09:57:08 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Ionic Wind Support Team

June 09, 2006, 09:57:08 PM Last Edit: June 12, 2006, 09:44:49 PM by Paul Turley
Just something fun I have been playing with.  CImage can be used to download images straight from the net.  So as an application of this, and a cool example, this program loads the current doppler radar images from NOAA and creates an overlaid display of topography, rivers, and highways.


class CRadar : CWindow
{
string m_Station;
int m_bBaseRefl;
int m_bCompRefl;
int m_bBaseVelocity;
int m_bShowRivers;
int m_bShowHighways;
int m_bShowCities;
int m_bAutoUpdate;
int m_bWarnings;
int m_bShowLegend;
CWindow m_winDisplay;
float m_flZoom;
declare CRadar()
{
m_Station = "";
m_bBaseRefl = false;
m_bBaseVelocity = false;
m_bCompRefl = true;
m_bShowRivers = false;
m_bShowHighways = false;
m_bShowCities = true;
m_bAutoUpdate = false;
m_bWarnings = true;
m_bShowLegend = true;
m_flZoom = 1.0f;
}
declare OnClose(),int;
declare OnCreate(),int;
declare OnControl(int nID, int nNotifyCode, unsigned int hControl),int;
declare Update();

declare OnTimer(int nIDEvent),int
{
Update();
}

}

CRadar::OnClose(),int
{
if(m_bAutoUpdate)
StopTimer();
Destroy();
}

CRadar::OnCreate(),int
{
CenterWindow();
m_winDisplay.Create(0,0,600,550,AWS_VISIBLE|AWS_CHILD|AWS_AUTODRAW,0,"",this);
AddControl(CTBUTTON,"Refresh",665,20,80,20,AWS_VISIBLE,0,100);
AddControl(CTCOMBOBOX,"",620,50,160,200,AWS_VISIBLE|AWS_VSCROLL|ACBS_DROPDOWNLIST,0,200);
AddControl(CTCHECKBOX,"Base Refl.",620,80,120,20,AWS_VISIBLE,0,300);
AddControl(CTCHECKBOX,"Composite Refl.",620,105,120,20,AWS_VISIBLE,0,301);
AddControl(CTCHECKBOX,"Base Velocity",620,130,120,20,AWS_VISIBLE,0,302);
AddControl(CTCHECKBOX,"Show Rivers",620,155,120,20,AWS_VISIBLE,0,303);
AddControl(CTCHECKBOX,"Show Highways",620,180,128,20,AWS_VISIBLE,0,304);
AddControl(CTCHECKBOX,"Show Cities",620,205,128,20,AWS_VISIBLE,0,305);
AddControl(CTCHECKBOX,"Show Legend",620,230,128,20,AWS_VISIBLE,0,306);

AddControl(CTRADIOBUTTON,"100%",620,255,128,20,AWS_VISIBLE|AWS_GROUP,0,400);
AddControl(CTRADIOBUTTON,"150%",620,280,128,20,AWS_VISIBLE,0,401);
AddControl(CTRADIOBUTTON,"200%",620,305,128,20,AWS_VISIBLE,0,402);
AddControl(CTRADIOBUTTON,"250%",620,330,128,20,AWS_VISIBLE,0,403);

AddControl(CTCHECKBOX,"Auto Update",620,380,128,20,AWS_VISIBLE,0,500);

CComboBox *pBox = GetControl(200);
pBox->SetFont("Arial",10,400);
pBox->AddString("abr - Aberdeen, SD");
pBox->AddString("abx - La Mesita Negra/Albuquerque, NM");
pBox->AddString("ahg - Anchorage/Kenei, AK");
pBox->AddString("aih - Middleton Islands, AK");
pBox->AddString("akq - Wakefield/Norfolk-Richmond, VA");
pBox->AddString("ama - Amarillo, TX");
pBox->AddString("amx - Miami, FL");
pBox->AddString("apx - Alpena/Gaylord, MI");
pBox->AddString("arx - LaCrosse, WI");
pBox->AddString("atx - Everett/Seattle-Tacoma, WA");
pBox->AddString("bbx - Beale AFB, CA");
pBox->AddString("bgm - Binghamton, NY");
pBox->AddString("bhx - Eureka, CA");
pBox->AddString("bis - Bismarck, ND");
pBox->AddString("blx - Billings, MT");
pBox->AddString("bmx - Shelby County AP/Birmingham, AL");
pBox->AddString("box - Taunton/Boston, MA");
pBox->AddString("bro - Brownsville, TX");
pBox->AddString("buf - Buffalo, NY");
pBox->AddString("byx - Key West, FL");
pBox->AddString("cae - Columbia, SC");
pBox->AddString("cbw - Caribou (Loring AFB), ME");
pBox->AddString("cbx - Boise, ID");
pBox->AddString("ccx - Moshannon St Forest/State College, PA");
pBox->AddString("cle - Cleveland, OH");
pBox->AddString("clx - Charleston, SC");
pBox->AddString("crp - Corpus Christi, TX");
pBox->AddString("cxx - Burlington, VT");
pBox->AddString("cys - Cheyenne, WY");
pBox->AddString("dax - McClellan AFB/Sacremento, CA");
pBox->AddString("ddc - Dodge City, KS");
pBox->AddString("dfx - Bracketville/Laughlin AFB, TX");
pBox->AddString("dgx - Jackson/Brandon, MS");
pBox->AddString("dix - Fort Dix, NJ/Philadelphia, PA");
pBox->AddString("dlh - Duluth, MN");
pBox->AddString("dmx - Acorn Valley/Des Moines, IA");
pBox->AddString("dox - Dover AFB, DE");
pBox->AddString("dtx - Pontiac/Detroit, MI");
pBox->AddString("dvn - Davenport/Quad Cities, IA");
pBox->AddString("dyx - Moran/Dyess AFB, TX");
pBox->AddString("eax - Pleasant Hill/KC, MO");
pBox->AddString("emx - Tucson, AZ");
pBox->AddString("enx - East Berne/Albany, NY");
pBox->AddString("eox - Ft. Rucker, AL");
pBox->AddString("epz - El Paso, TX");
pBox->AddString("esc - Las Vegas, NV");
pBox->AddString("evx - Red Bay/Eglin AFB, FL");
pBox->AddString("ewx - New Braunfels AP/Austin-San Ant, TX");
pBox->AddString("eyx - Edwards AFB, CA");
pBox->AddString("fcx - Roanoke, VA");
pBox->AddString("fdr - Frederick, OK");
pBox->AddString("fdx - Field Village/Cannon AFB, NM");
pBox->AddString("ffc - Peach Tree City/Atlanta, GA");
pBox->AddString("fsd - Sioux Falls, SD");
pBox->AddString("fsx - Flagstaff, AZ");
pBox->AddString("ftg - Front Range AP/Denver, CO");
pBox->AddString("fws - Spinks AP/Dallas-Ft Worth, TX");
pBox->AddString("ggw - Glasgow, MT");
pBox->AddString("gjx - Grand Junction, CO");
pBox->AddString("gld - Goodland, KS");
pBox->AddString("grb - Green Bay, WI");
pBox->AddString("grk - Central Texas (Ft Hood), TX");
pBox->AddString("grr - Grand Rapids/Muskegon, MI");
pBox->AddString("gsp - Greenville/Spartanburg (Greer), SC");
pBox->AddString("gwx - Columbus AFB, MS");
pBox->AddString("gyx - Gray/Portland, ME");
pBox->AddString("hdx - Holloman AFB, NM");
pBox->AddString("hgx - League City/Houston, TX");
pBox->AddString("hki - South Kauai, HI");
pBox->AddString("hkm - Kohala, HI");
pBox->AddString("hmo - Molokai, HI");
pBox->AddString("hnx - Hanford AP/San Joaquin Valley, CA");
pBox->AddString("hpx - Ft. Campbell, KY");
pBox->AddString("htx - N.E./Hytop, AL");
pBox->AddString("hwa - South Hawaii, HI");
pBox->AddString("ict - Wichita, KS");
pBox->AddString("icx - Cedar City, UT");
pBox->AddString("iln - Wilmington/Cincinnati, OH");
pBox->AddString("ilx - Central (Springfield), IL");
pBox->AddString("ind - Indianapolis, IN");
pBox->AddString("inx - Shreck Farm/Tulsa, OK");
pBox->AddString("iwa - Williams AFB/Phoenix, AZ");
pBox->AddString("iwx - Webster, IN");
pBox->AddString("jax - Jacksonville, FL");
pBox->AddString("jgx - Robins AFB, GA");
pBox->AddString("jkl - Jackson, KY");
pBox->AddString("jua - San Juan, PR");
pBox->AddString("lbb - Lubbock, TX");
pBox->AddString("lch - Lake Charles, LA");
pBox->AddString("lix - Slidell AP/New Orleans, LA");
pBox->AddString("lnx - North Platte, NE");
pBox->AddString("lot - Chicago, IL");
pBox->AddString("lrx - Elko, NV");
pBox->AddString("lsx - St Charles City/St Louis, MO");
pBox->AddString("ltx - Shallotte/Wilmington, NC");
pBox->AddString("lvx - Ft Knox Mil Res/Louisville, KY");
pBox->AddString("lwx - Sterling, VA/Washington DC");
pBox->AddString("lzk - Little Rock, AR");
pBox->AddString("maf - Midland/Odessa, TX");
pBox->AddString("max - Medford, OR");
pBox->AddString("mbx - Minot AFB, ND");
pBox->AddString("mhx - Newport/Morehead City, NC");
pBox->AddString("mkx - Sullivan Township/Milwaukee, WI");
pBox->AddString("mlb - Melbourne, FL");
pBox->AddString("mob - Mobile, AL");
pBox->AddString("mpx - Chanhassen Township/Minn-St.P, MN");
pBox->AddString("mqt - Marquette, MI");
pBox->AddString("mrx - Knoxville, TN");
pBox->AddString("msx - Pt Six Mtn/Missoula, MT");
pBox->AddString("mtx - Promontory Pt/Salt Lake City, UT");
pBox->AddString("mxx - Carrville/Maxwell AFB, AL");
pBox->AddString("mux - Mt Umunhum/San Francisco, CA");
pBox->AddString("mvx - Fargo, ND");
pBox->AddString("nkx - San Diego, CA");
pBox->AddString("nqa - Millington NAS/Memphis, TN");
pBox->AddString("oax - Omaha, NE");
pBox->AddString("ohx - Old Hickory Mt/Nashville, TN");
pBox->AddString("okx - Brookhaven/New York City, NY");
pBox->AddString("otx - Spokane, WA");
pBox->AddString("pah - Paducah, KY");
pBox->AddString("pbz - Coraopolis/Pittsburgh, PA");
pBox->AddString("pdt - Pendleton, OR");
pBox->AddString("poe - Ft Polk, LA");
pBox->AddString("pux - Pueblo, CO");
pBox->AddString("rax - Triple West AP/Raleigh-Durham, NC");
pBox->AddString("riw - Riverton, WY");
pBox->AddString("rgx - Virginia Peak/Reno, NV");
pBox->AddString("rlx - Charleston, WV");
pBox->AddString("rtx - Portland, OR");
pBox->AddString("sfx - Pocatello/Idaho falls, ID");
pBox->AddString("sgf - Springfield, MO");
pBox->AddString("shv - Shreveport, LA");
pBox->AddString("sjt - San Angelo, TX");
pBox->AddString("sox - Santa Ana Mountains/March AFB, CA");
pBox->AddString("srx - Western Arkansas/Ft. Smith, AR");
pBox->AddString("tbw - Ruskin/Tampa Bay, FL");
pBox->AddString("tfx - Great Falls, MT");
pBox->AddString("tlh - Tallahassee, FL");
pBox->AddString("tlx - Twin Lakes/Oklahoma City, OK");
pBox->AddString("twx - Wabaunsee County/Topeka, KS");
pBox->AddString("tyx - Ft Drum AFB/Montague, NY");
pBox->AddString("udx - Rapid City, SD");
pBox->AddString("uex - Grand Island, NE");
pBox->AddString("vax - Moody AFB, GA");
pBox->AddString("vbx - Vandenberg AFB, CA");
pBox->AddString("vnx - Vance AFB, OK");
pBox->AddString("vtx - Sulphur Mtn/Los Angeles, CA");
pBox->AddString("yux - Yuma, AZ");
m_Station = "BUF";
pBox->SetCurSel(18);
//set checkbox colors
CButton *pCheck;
for(int x=300;x<=306;x++)
{
pCheck = GetControl(x);
pCheck->SetColor(0,RGB(255,255,255));
}
for(x=400;x<=403;x++)
{
pCheck = GetControl(x);
pCheck->SetColor(0,RGB(255,255,255));
}
pCheck = GetControl(301);
pCheck->SetCheck(m_bCompRefl);
pCheck = GetControl(305);
pCheck->SetCheck(m_bShowCities);
pCheck = GetControl(306);
pCheck->SetCheck(m_bShowLegend);
pCheck = GetControl(400);
pCheck->SetCheck(true);
pCheck = GetControl(500);
pCheck->SetColor(0,RGB(255,255,255));
}

CRadar::OnControl(int nID, int nNotifyCode, unsigned int hControl),int
{
select(nID)
{
case 100:
if(nNotifyCode == 0)
{
Update();
}
case 200:
if(nNotifyCode == CBNSELCHANGE)
{
CComboBox *pBox = GetControl(200);
string sel = pBox->GetItemText(pBox->GetCurSel());
sel = strupper(sel);
m_Station = strleft(sel,3);
Update();
}
case 300:
if(nNotifyCode == 0)
{
CButton *pCheck = GetControl(300);
m_bBaseRefl = pCheck->GetCheck();
Update();
}
case 301:
if(nNotifyCode == 0)
{
pCheck = GetControl(301);
m_bCompRefl = pCheck->GetCheck();
Update();
}
case 302:
if(nNotifyCode == 0)
{
pCheck = GetControl(302);
m_bBaseVelocity = pCheck->GetCheck();
Update();
}
case 303:
if(nNotifyCode == 0)
{
pCheck = GetControl(303);
m_bShowRivers = pCheck->GetCheck();
Update();
}
case 304:
if(nNotifyCode == 0)
{
pCheck = GetControl(304);
m_bShowHighways = pCheck->GetCheck();
Update();
}
case 305:
if(nNotifyCode == 0)
{
pCheck = GetControl(305);
m_bShowCities = pCheck->GetCheck();
Update();
}
case 306:
if(nNotifyCode == 0)
{
pCheck = GetControl(306);
m_bShowLegend = pCheck->GetCheck();
Update();
}
case 400:
case& 401:
case& 402:
case& 403:
if(nNotifyCode == 0)
{
m_flZoom = 1.0f + ((nID-400) * .50);
Update();
}
case 500:
if(nNotifyCode == 0)
{
pCheck = GetControl(500);
m_bAutoUpdate = pCheck->GetCheck();
if(m_bAutoUpdate)
StartTimer(50000) //every 5 minutes
else
StopTimer();
}

}
}

CRadar::Update()
{
int l,t,w,h;
w = 600 * m_flZoom;
h = 550 * m_flZoom;
//offset the difference in size
l = 600/2 - w/2;
t = 550/2 - h/2;
CImage img;
img.LoadFromFile("http://www.srh.noaa.gov/ridge/Overlays/Topo/Short/"+m_Station+"_Topo_Short.jpg");
img.Render(m_winDisplay,l,t,w,h);
img.LoadFromFile("http://www.srh.noaa.gov/ridge/Overlays/County/Short/"+m_Station+"_County_Short.gif");
img.Render(m_winDisplay,l,t,w,h);
if(m_bBaseRefl)
{
img.LoadFromFile("http://www.srh.noaa.gov/ridge/RadarImg/N0R/"+m_Station+"_N0R_0.gif");
img.Render(m_winDisplay,l,t,w,h);
}
if(m_bCompRefl)
{
img.LoadFromFile("http://www.srh.noaa.gov/ridge/RadarImg/NCR/"+m_Station+"_NCR_0.gif");
img.Render(m_winDisplay,l,t,w,h);
}
if(m_bBaseVelocity)
{
img.LoadFromFile("http://www.srh.noaa.gov/ridge/RadarImg/N0V/"+m_Station+"_N0V_0.gif");
img.Render(m_winDisplay,l,t,w,h);
}
if(m_bWarnings)
{
img.LoadFromFile("http://www.srh.noaa.gov/ridge/Warnings/Short/"+m_Station+"_Warnings_0.gif");
img.Render(m_winDisplay,l,t,w,h);

}
if(m_bShowRivers)
{
img.LoadFromFile("http://www.srh.noaa.gov/ridge/Overlays/Rivers/Short/"+m_Station+"_Rivers_Short.gif");
img.Render(m_winDisplay,l,t,w,h);

}
if(m_bShowHighways)
{
img.LoadFromFile("http://www.srh.noaa.gov/ridge/Overlays/Highways/Short/"+m_Station+"_Highways_Short.gif");
img.Render(m_winDisplay,l,t,w,h);

}
if(m_bShowCities)
{
img.LoadFromFile("http://www.srh.noaa.gov/ridge/Overlays/Cities/Short/"+m_Station+"_City_Short.gif");
img.Render(m_winDisplay,l,t,w,h);

}
if(m_bShowLegend)
{
img.LoadFromFile("http://www.srh.noaa.gov/ridge/Legend/NCR/"+m_Station+"_NCR_Legend_0.gif");
//don't 'zoom' the legend
img.Render(m_winDisplay,0,0,600,550);

}

}

global sub main
{
CRadar win;
win.Create(0,0,800,600, AWS_CAPTION | AWS_SYSMENU | AWS_MINIMIZEBOX | AWS_VISIBLE,0,"Radar",0);
win.Update();
do{ wait(); }until !win.IsValid();
}



The source is attached as well for easier access.
Ionic Wind Support Team

Ionic Wind Support Team

June 09, 2006, 10:09:36 PM #1 Last Edit: June 12, 2006, 09:47:59 PM by Paul Turley
Updated to include city information
Ionic Wind Support Team

kryton9

That is really neat Paul. Some cool stuff for sure!!

Doc

Nifty stuff Paul. :)

I now have a modified (scaled down) version that with only four clicks, covers every member of my family.  8)

-Doc-

Ionic Wind Support Team

I was trying to add the satellite image as an overlay too.  But NOAA uses different image sizes and doesn't separate them by radar stations.  They are also stored in TIFF format so are rather large (10M).

You can get the raw doppler data from their FTP server, it is a hard format to work with ;)

The doppler images update every 6 to 10 minutes for those that are wondering. 
Ionic Wind Support Team

Ionic Wind Support Team

Now includes an auto update timer.  Set for every 5 minutes but you can change to what pleases you ;)
Ionic Wind Support Team

Ionic Wind Support Team

Updated to show warning boxes and a legend.
Ionic Wind Support Team

Brian

Paul,

That's a great program! Do they do the same kind of radar maps for the United Kingdom? Could it be added in?

Brian

Ionic Wind Support Team

Don't know.   NOAA is our National Oceanic and Atmospheric Agency.   If the UK has something similar with online data from your radar network then it wouldn't be too difficult to do.
Ionic Wind Support Team

GWS

Can't get it to run in Win98SE,IE6,DX7, I'm afraid .. :(

I get:

WEATHERMAN caused an invalid page fault in
module GDI.EXE at 0001:00006003.
Registers:
EAX=00000647 CS=04d7 EIP=00006003 EFLGS=00000246
EBX=0000fc18 SS=2def ESP=000088de EBP=000088e0
ECX=eca40c14 DS=0647 ESI=00001a07 FS=1a07
EDX=00012def ES=0177 EDI=00000177 GS=0000
Bytes at CS:EIP:
67 66 8b 83 00 00 01 00 eb 17 67 f6 43 02 40 67
Stack dump:
89060647 04d79f82 0177fc18 01771a07 00000000 00000000 00000022 41f70000 299abff7 9f6ebff7 0020895c 000701a7 00000000 4eebfc18 00288960 28a201a7

when the screen opens.

Graham :)
Tomorrow may be too late ..

Ionic Wind Support Team

Don't have any 98 systems to test on at the moment.  Only Linux and XP here.

Make sure your connected to the net when running. Could be something missing on your system such as IOLEPicture not working correctly.
Ionic Wind Support Team

GWS

July 07, 2006, 12:02:26 PM #11 Last Edit: July 07, 2006, 12:30:12 PM by GWS
Thanks for reply Paul .. yes I am connected when running it, but 'IOLEPicture*' is not coming up with anything in a file search.ÂÃ,  Probl'y Win98 doesn't have the required facilities.

Not to worry, I'll try another program .. :)

best wishes, :)

Graham
Tomorrow may be too late ..

Parker

IOLEPicture wouldn't be a file, so it wouldn't come up in a file search. However, a member named Jose Roca posted a COM interface viewer that you can use to search your computer for it.

JR

IOlePicture? Must be IPicture. This interface is defined in STDOLE32.TLB.

GWS

Ah! ..OK .. found STDOLE32.TLB :).ÂÃ,  Yep it's there OK in Win98 - but the prog still bombs out.

Graham :)
Tomorrow may be too late ..

GWS

Example 'frags2d' fails in exactly the same way.ÂÃ,  My Win98 installation is a brand new one, so I don't think there will be any corrupted files.ÂÃ,  The way the screen goes haywire, it looks more like a graphics problem.
I'm on a GeForce FX5700LE.

Graham :)
Tomorrow may be too late ..

Ionic Wind Support Team

Might be a driver issue.  The radar program doesn't use directX at all.

If anyone else that might have 98 lying around can test it then I am sure it would be appreciated.
Ionic Wind Support Team

Earn

Graham,
Here are a few thing to try:

  • Update the video driver.
  • Turn off graphics hardware acceleration.
  • Replace the GDI.EXE file.
  • Check for overheating or failing CPU.
Good luck.
Earn

GWS

Yep! .. I'll do some checking ..ÂÃ,  :) maybe this installation is faulty in some way .. I hate windows ..

This might take some time .. ::)

Graham :)
Tomorrow may be too late ..

J B Wood (Zumwalt)


GWS

 :) .. format *.*

I found another program not working which had been OK before, so something was wrong - but goodness knows what.

So I'm back up with XP (gulp :o) - just need to re-install lots of other progs now ..

Then I'll get back to trying to understand these hieroglyphics you guys are planning to write programs in .. :)

all the best,

Graham
Tomorrow may be too late ..

mrainey

Graham,

XP is much better than 98, it just looks stupid "out of the box"!  If you want a hand with stripping away the gunk, just say so.


                                                           Mike
Software For Metalworking
http://closetolerancesoftware.com

Vikki

Graham,

Mike is right. I have set up XP to look like classic windows which makes things a bit more familiar. Once you get used to it, it's not so bad.ÂÃ,  ;)

Just keep repeating...no more blue screens, no more blue screens...ÂÃ,  ;D

GWS

Mike> thanks .. but I think there is about 2Gb of 'junk', goodness knows what it's all doingÂÃ,  ..ÂÃ,  :)
I've currently got 23 'processes' running ..ÂÃ,  ::) and I'm only typing this message ..

Vikki>.. lovely to hear from youÂÃ,  :)ÂÃ,  I think I'm getting it sorted with the old style arrangement - it certainly looks prettier.ÂÃ,  Makes you wonder why MS bothered with their 'new' look.ÂÃ,  I've even imported 'File Manager' (otherwise known as WinFile), which I like much better than Windows Explorer.

I imagine the examples will work OK now in XP when I get it loaded again.ÂÃ,  I'm an armchair critic of this new stuff, but some folk get very defensive and dismissive if I say anything.

I'd love to have a section (possibly hidden) where discussion of principles could take place objectively.
I think this would either corect my 'programmatically incorrect' views - or maybe show up areas where new users like myself could learn why things are as they are.ÂÃ,  Currently, I just bite my tongue .. :)

all the best folks, :)

Graham
Tomorrow may be too late ..

Vikki

 :o 23!!! How'd you do that. I have 56 running right now. I have Outlook open, Trillian open and IE....I have no idea how to clean them up or what is ok to clean up...I'm a little afraid of messing with it...and it works ok, so I won't worry about it. Kudos on getting it down to 23 processes.ÂÃ,  8)

I understand about the changes. It was heck when my boss required that I load Win2k...I absolutely refused to load winME, thank goodness!

That section you mention would be perfect because anything that would help to make sense of things would be great!  :) I think I may be just too old to learn the new tricks but I'm really gonna give it a good go.