comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Overlaying gridded winds on satellite data
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Overlaying gridded winds on satellite data [message #44804] Wed, 20 July 2005 10:39 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Chris writes:

> Hey David...I think I have it worked out...in the imagemap procedure it
> has uses a border around the satellite data...where as the wind barbs
> do not...therefore... I eliminated the border from the satellite
> data...and found it to work then. I thank you again for all of your
> effort...this has frustrated me for a couple of days...and I knew it
> was a simple error.

Well, borders often come into play when we are working
with images and map projections, and if you say it is
fixed, I'll take your word for it. But something still
doesn't make sense to me about this... But I'm willing
to let it drop. I'm back in the US and the pile on my
desk is HUGE. I probably have better things to do. :-)

> I have one more question for you though...in the
> wind barb procedure, when you say the wind barbs are pointing in the
> wrong direction...does that just mean the barbs and pennants are drawn
> on the wrong side of the line or the actual wind direction is thrown
> off by 180 degrees? Thanks again for the help.

I don't think I said the wind bards "are pointing in
the wrong direction". I think I said "I don't know for
sure *which* direction they should be pointing in, and
I had received contradictory advice from people who's
job it was to know. So I let you choose which direction
pleases you. But, in any case, I think everyone who complained
was complaining about the direction of the staff, not the flags.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Overlaying gridded winds on satellite data [message #44805 is a reply to message #44804] Wed, 20 July 2005 10:03 Go to previous messageGo to next message
Chris[3] is currently offline  Chris[3]
Messages: 7
Registered: July 2005
Junior Member
Hey David...I think I have it worked out...in the imagemap procedure it
has uses a border around the satellite data...where as the wind barbs
do not...therefore... I eliminated the border from the satellite
data...and found it to work then. I thank you again for all of your
effort...this has frustrated me for a couple of days...and I knew it
was a simple error. I have one more question for you though...in the
wind barb procedure, when you say the wind barbs are pointing in the
wrong direction...does that just mean the barbs and pennants are drawn
on the wrong side of the line or the actual wind direction is thrown
off by 180 degrees? Thanks again for the help.

Chris
Re: Overlaying gridded winds on satellite data [message #44806 is a reply to message #44805] Wed, 20 July 2005 09:53 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Chris writes:

> Thanks for your help...when I run the cursor command...I run it right
> after the imagemap procedure...then after that I run it after the
> windbarb procedure...and when I do that...the result is differing
> latitudes and longitudes of only about .05 degrees. When I use the
> cursor command...this is how I write it.
>
> cursor, long, lat
> print, lat, long
>
> I see you mention something about DOWN and DATA keywords...what exactly
> do they do? Thank you again for all of your support.

The DOWN keyword makes sure you only get DOWN cursor
events, not up or movement events. DATA makes sure your
results are in data coordinates (you hope lat and lon in
this case). I would definitely try this again with DOWN
set. Cursor does DATA coordinates by default.

I just don't see where the error could be. I actually
draw the wind barbs in normalized coordinates, but I
use Convert_Coord to convert from data to normalized
coordinates, and I have never had the least bit of trouble
with that.

Don't know. Sorry. It is a pretty small error, it seems
to me. Are you certain the continental outlines are in the
right place?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Overlaying gridded winds on satellite data [message #44808 is a reply to message #44806] Wed, 20 July 2005 09:33 Go to previous messageGo to next message
Chris[3] is currently offline  Chris[3]
Messages: 7
Registered: July 2005
Junior Member
Hey David,

Thanks for your help...when I run the cursor command...I run it right
after the imagemap procedure...then after that I run it after the
windbarb procedure...and when I do that...the result is differing
latitudes and longitudes of only about .05 degrees. When I use the
cursor command...this is how I write it.

cursor, long, lat
print, lat, long

I see you mention something about DOWN and DATA keywords...what exactly
do they do? Thank you again for all of your support.

Chris

David Fanning wrote:
> Chris writes:
>
>> I forgot to mention how I came up with my conclusion that the latitudes
>> and longitudes do not match up. I used the cursor procedure which I
>> then print to the screen to tell me the latitude and longitude of
>> certain pixels...I use the corner to make sure I click on the same
>> pixel...and the latitudes and longitudes do not match up. Thanks again
>> for all of your help.
>
> Humm. Well, I don't see any reason this doesn't work
> perfectly. :-)
>
> Liam is setting up the map projection for you (Mercator
> in this case), and the wind barbs are certainly going onto
> the map in data coordinate space. Makes me think you
> are not doing the CURSOR command properly. Are you using
> the DOWN and DATA keywords with it? And are you using
> it immediately after you run this program?
>
> Just don't have many other ideas.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Overlaying gridded winds on satellite data [message #44809 is a reply to message #44808] Wed, 20 July 2005 09:14 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Chris writes:

> I forgot to mention how I came up with my conclusion that the latitudes
> and longitudes do not match up. I used the cursor procedure which I
> then print to the screen to tell me the latitude and longitude of
> certain pixels...I use the corner to make sure I click on the same
> pixel...and the latitudes and longitudes do not match up. Thanks again
> for all of your help.

Humm. Well, I don't see any reason this doesn't work
perfectly. :-)

Liam is setting up the map projection for you (Mercator
in this case), and the wind barbs are certainly going onto
the map in data coordinate space. Makes me think you
are not doing the CURSOR command properly. Are you using
the DOWN and DATA keywords with it? And are you using
it immediately after you run this program?

Just don't have many other ideas.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Overlaying gridded winds on satellite data [message #44810 is a reply to message #44809] Wed, 20 July 2005 08:47 Go to previous messageGo to next message
Chris[3] is currently offline  Chris[3]
Messages: 7
Registered: July 2005
Junior Member
I forgot to mention how I came up with my conclusion that the latitudes
and longitudes do not match up. I used the cursor procedure which I
then print to the screen to tell me the latitude and longitude of
certain pixels...I use the corner to make sure I click on the same
pixel...and the latitudes and longitudes do not match up. Thanks again
for all of your help.

Chris
Re: Overlaying gridded winds on satellite data [message #44811 is a reply to message #44810] Wed, 20 July 2005 08:45 Go to previous messageGo to next message
Chris[3] is currently offline  Chris[3]
Messages: 7
Registered: July 2005
Junior Member
My code is attached to this message. The Imagemap procedure is the
procedure by Dr. Liam Gumley which displays the satellite data to a
window. Reading through the code for that procedure...I see no specific
projection...I am imagining it's just the satellite projection. The
Windbarb1 procedure was written by David Fanning...which draws the wind
barbs. The grid on which the wind barbs are on is a 2 km resolution, so
1800 x 1800 km total, however it uses latitude and longitude for those
coordinates. If you guys need any more information in helping me with
this...I can certainly give it...thank you for all of your help...it's
greatly appreciated.



pro barbtest2

;Defining all arrays needed
lat1=fltarr(900,900)
long1=fltarr(900,900)
windspeed=fltarr(900,900)
winddir=fltarr(900,900)
upert=fltarr(900,900)
vpert=fltarr(900,900)

;Opening and reading in latitude and longitude
openr, lun, 'C:\Documents and
Settings\jewett\Desktop\IDL\latitude.dat', /get_lun
readf, lun, lat1
close, lun
openr, lun, 'C:\Documents and
Settings\jewett\Desktop\IDL\longitude.dat', /get_lun
readf, lun, long1
close, lun
openr, lun, 'C:\Documents and
Settings\jewett\Desktop\IDL\1815Sept21\1000_900upert.dat', /get_lun
readf, lun, upert
close, lun
openr, lun, 'C:\Documents and
Settings\jewett\Desktop\IDL\1815Sept21\1000_900vpert.dat', /get_lun
readf, lun, vpert
close, lun

windspeed=sqrt(upert*upert+vpert*vpert)
winddir=-asin(vpert/windspeed)*57.29577951+270
windspeed=windspeed*1.94384449

windspeed1=sqrt(upert1*upert1+vpert1*vpert1)
winddir1=-asin(vpert1/windspeed1)*57.29577951+270
windspeed1=windspeed1*1.94384449
cdfid=ncdf_open("C:\Documents and
Settings\jewett\Desktop\research\netcdf\NETCDF13.nc")
glob=ncdf_inquire(cdfid)

;Finding the dimensions and variables of the netCDF file
print, 'Dimensions', glob.ndims
print, 'variables', glob.nvars
for i=0, glob.ndims-1 do begin
ncdf_diminq, cdfid, i, name, size
if i EQ glob.recdim then $
print, ' ', name, size, '(Unlimited dim)' $
else $
print, ' ', name, size
endfor
print, 'variables'
for i=0, glob.nvars-1 do begin
info = ncdf_varinq(cdfid,i)
FmtStr= '(A,"(",A,") Dimension Ids = [ ", 10(I0," "))'
print, FORMAT=FmtStr, info.name, info.datatype, info.dim[*]

for j=0, info.natts-1 do begin
attname=ncdf_attname(cdfid,i,j)
ncdf_attget, cdfid, i, attname, attvalue
print, ' Attribute ', attname, '=',
string(attvalue)
endfor
endfor
;Obtaining variables from the netCDF file
dataid=ncdf_varid(cdfid, 'data')
ncdf_varget, cdfid, dataid, satellite
latitude=ncdf_varid(cdfid, 'latitude')
ncdf_varget, cdfid, latitude, lat
longitude=ncdf_varid(cdfid, 'longitude')
ncdf_varget, cdfid, longitude, longitude
time=ncdf_varid(cdfid, 'imageTime')
ncdf_varget, cdfid, time, time

;Calling procedure which displays the visible satellite image

imagemap, satellite, lat, longitude
map_continents, Color=FSC_Color('Sea Green', !D.Table_Size-3),
/hires

;Begin procedure which which draws windbarbs...need longitude,
latitude, windspeed and wind direction
Windbarb1, long1[0:*:5,0:*:5], lat1[0:*:5,0:*:5],
windspeed[0:*:5,0:*:5], winddir[0:*:5,0:*:5], Color='Indian Red';,
clip=clip
end
Re: Overlaying gridded winds on satellite data [message #44813 is a reply to message #44811] Wed, 20 July 2005 06:08 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
kuyper@wizard.net writes:

> We can't know how to fix it until we know what you're doing. Please
> provide a simplified version of your code. Also, you need to explain
> how you know that the latitudes and longitudes are not matched up
> correctly: what are the symptoms that lead you to this conclusion?

And, in particular, please tell us how you are setting
up the map projection and how you are either (1) warping
the image to that map projection or (2) aligning the
map projection to that image.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Overlaying gridded winds on satellite data [message #44814 is a reply to message #44813] Wed, 20 July 2005 05:44 Go to previous messageGo to next message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Chris wrote:
> Hello all...this maybe a rather simple question...but for some reason I
> am having problems and getting rather frustrated. I am hoping that you
> guys may have an answer for me. I have visible satellite data which is
> in NetCDF format which I can easily get displayed. However, my problem
> is laying gridded wind barbs...which are in 900x900 arrays to print on
> top of the satellite data. Everytime I do it...the latitudes and
> longitudes do not match up correctly...they are close but not correct.
> Does anyone know how I could fix this? Thanks for all the help.

We can't know how to fix it until we know what you're doing. Please
provide a simplified version of your code. Also, you need to explain
how you know that the latitudes and longitudes are not matched up
correctly: what are the symptoms that lead you to this conclusion?
Re: Overlaying gridded winds on satellite data [message #44946 is a reply to message #44804] Wed, 20 July 2005 13:31 Go to previous message
Chris[3] is currently offline  Chris[3]
Messages: 7
Registered: July 2005
Junior Member
Hey David...I just wanted to thank you again for all of your
help...it's been great and I have learned a lot. I have one more quick
question for you...and I promise I'll try to not bother you again. With
the wind barb procedure...the second direction is the correct
way...however the barbs point in the wrong direction...do you know
which part of the code I can fix this in? Thanks a bunch for all of
your help.

Chris

David Fanning wrote:
> Chris writes:
>
>> Hey David...I think I have it worked out...in the imagemap procedure it
>> has uses a border around the satellite data...where as the wind barbs
>> do not...therefore... I eliminated the border from the satellite
>> data...and found it to work then. I thank you again for all of your
>> effort...this has frustrated me for a couple of days...and I knew it
>> was a simple error.
>
> Well, borders often come into play when we are working
> with images and map projections, and if you say it is
> fixed, I'll take your word for it. But something still
> doesn't make sense to me about this... But I'm willing
> to let it drop. I'm back in the US and the pile on my
> desk is HUGE. I probably have better things to do. :-)
>
>> I have one more question for you though...in the
>> wind barb procedure, when you say the wind barbs are pointing in the
>> wrong direction...does that just mean the barbs and pennants are drawn
>> on the wrong side of the line or the actual wind direction is thrown
>> off by 180 degrees? Thanks again for the help.
>
> I don't think I said the wind bards "are pointing in
> the wrong direction". I think I said "I don't know for
> sure *which* direction they should be pointing in, and
> I had received contradictory advice from people who's
> job it was to know. So I let you choose which direction
> pleases you. But, in any case, I think everyone who complained
> was complaining about the direction of the staff, not the flags.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Transparency for IDLgrVolume in IDL 6.1
Next Topic: Why IDL needs Garbage Collection

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:42:09 PDT 2025

Total time taken to generate the page: 0.00539 seconds