Re: Overlaying gridded winds on satellite data [message #44804] |
Wed, 20 July 2005 10:39  |
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 #44806 is a reply to message #44805] |
Wed, 20 July 2005 09:53   |
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   |
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 #44811 is a reply to message #44810] |
Wed, 20 July 2005 08:45   |
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 #44946 is a reply to message #44804] |
Wed, 20 July 2005 13:31  |
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/
|
|
|