On Jun 3, 9:46 pm, David Fanning <n...@dfanning.com> wrote:
> pp writes:
>> You need to say more about what you are doing and why it does not
>> work. It is (nearly) irrelevant that the two variables are in
>> different grids. You can just overplot them.
>
> Yes, I agree. The OVERPLOT keyword is basically
> all that is needed here, which is why I was confused
> about what kind of "ideas" you wanted.
>
> You set your map data space, then simply overplot your
> two contours onto it. What grid they are on is irrelevant.
>
> More details as to the problems you have, please. :-)
>
> Cheers,
>
> David
>
This is indeed what I do: as extract from script shows -
****************************
; First use cdf2idl process to read in precip, then pv files.
; Rainfall has total per day, pv has four timesteps per day.
;
; Get the netCDF data into IDL arrays
; Precip:
lon_g=fltarr(360)+lon
lat_g=fltarr(180)+lat
date_g=fltarr(22)+date
pcp=fltarr(360,180,22)+pcp
lonndx_g=long(size(lon, /n_elements))
latndx_g=long(size(lat, /n_elements))
datendx_g=long(size(date, /n_elements))
; PV:
lat=G0_LAT_2
lon=G0_LON_3
time=INITIAL_TIME0_ENCODED
pv=PV_GDS0_THEL*10^6. ; pv now in PVU of 10^-6 K m^2 kg^-1
s^-1
lvl=LV_THEL1
lonndx=long(size(lon, /n_elements))
latndx=long(size(lat, /n_elements))
timendx=long(size(time, /n_elements))
k=6 ; 350K level only
date1=string(time[k])
date=strmid(date1,0,8)
utc=strmid(date1,7,2)
subb=string(date)+' '+string(utc)
counter=0L
daycounter=-0.25
For l=24,timendx-13 Do Begin ; to match rainfall data days
available in gpcp dataset
daycounter=daycounter+0.25 ; 4 PV to each rainfall day
map_set,-25,130,0,LIMIT=[-5,100,-45,160], /isotropic, /mercator,
position=[0.1,0.1,0.8,0.8]
contour,pcp[*,*,
(long(daycounter))],lon_g,lat_g,levels=[((findgen(21)+1)*5.) ,200], $
c_colors=(indgen(21)+1)+4,/isotropic, /cell_fill, $
c_charsize=0.2, /overplot, /noerase
contour, pv[*,*,k,l],lon,lat, levels=((findgen(25)*0.5)), $ ;
positive PV
c_colors=0,/isotropic, /follow,
c_labels=[Replicate(1,25)], $
c_charsize=0.5, /overplot, /noerase, color=0
contour, pv[*,*,k,l],lon,lat, levels=(((findgen(25)-25)*0.5)), $ ;
negative PV
c_colors=0,/isotropic, /follow,
c_labels=[Replicate(1,25)], $
c_charsize=0.5, /overplot, /noerase, color=0
map_continents, color=0, /hires
*********************************
However, if I load the variables from netcdf to idl variables, then
run this script; it plots fine. If I immediately rerun the same script
in the same idl session, I get the error:
"CONTOUR: X,Y, or Z array dimensions are incompatible."
The first couple of times I ran this script I was adding to it in
stages, and running it to see what the results were; the error was a
bit misleading in that way, as I thought it was the result of adding
the pv grids to the rainfall grids I already had working on the plot.
Hence my appeal to David and others for "ideas"! If I exit the IDL
session and reload the variables in a new session to rerun the script,
it plots fine first time. But only once per session!
Not sure why this happens, but unless it's immediately obvious to
anyone it's probably not worth pursuing...
Cheers,
Tess
|