Re: Explicit tick marks and labels not plotting when using overlay

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Jun 23 2010 - 15:26:20 MDT

BTW, I think you can get rid of some of the do loops to make your script run faster. Do loops will cause any scripting language to slow down, so you want to keep them to a minimum.

For example, the code:

do nl = 0,(dimsizes(pvclim&lat)-1)
   dlon = (pvclim&lon(2)-pvclim&lon(1))*0.0174533
 dx = 6378388*cos(0.0174533*pvclim&lat(nl))*dlon
 dpvdx_T(nl,:,:,:)= dpvdx_T(nl,:,:,:)/dx
end do

doesn't need to have the "dlon" calculation inside the loop, since it's the same every time through.

I believe you can accomplish the above without a do loop. Try this:

 dlon = (pvclim&lon(2)-pvclim&lon(1))*0.0174533
 dx = conform_dims(dimsizes(dpvdx_T),6378388*cos(0.0174533*pvclim&lat)*dlon,0)
 dpvdx_T= dpvdx_T/dx

I'm not entirely sure about the above. It will only work if the leftmost dimension of dpvdx_T is the same size as pvclim&lat.

This code:

do days = 0,car_dims(0)-1
  do levs = 0,car_dims(1)-1

    box_min(0,days,levs) = min(car_dpvdyLPF(days,levs,:,:))
    box_min(1,days,levs) = min(epac_dpvdyLPF(days,levs,:,:))

  end do ; levs
end do ; days

can be replaced by using "dim_min_n":

    box_min(0,days,levs) = dim_min_n(car_dpvdyLPF(days,levs,:,:),(/2,3/))
    box_min(1,days,levs) = dim_min_n(epac_dpvdyLPF(days,levs,:,:),(/2,3/))

This code:

    do car_lat = 0,car_dims(2)-1
      do car_lon = 0,car_dims(3)-1

        if ((.not.(ismissing(car_dpvdyLPF(days,levs,car_lat,car_lon)))).and.(ca\
r_dpvdyLPF(days,levs,car_lat,car_lon).lt.0.)) then
          box_area(0,days,levs) = box_area(0,days,levs) + (car_dpvdyLPF(days,le\
vs,car_lat,car_lon)/((car_dims(2)-1)*(car_dims(3)-1)))
        end if

      end do ; car_lon
    end do ; car_lat

can be replaced by using the "where" function:

    box_area(0,days,levs) = where((.not.(ismissing(car_dpvdyLPF(days,levs,:,:)))).and.(car_dpvdyLPF(days,levs,:,:).lt.0.), \
                                                       box_area(0,days,levs) + (car_dpvdyLPF(days,levs,:,:)/((car_dims(2)-1)*(car_dims(3)-1)))
                                                       box_area(0,days,levs))

I haven't tested all this, so there may be some syntax errors.

--Mary

On Jun 22, 2010, at 11:26 PM, Kay Shelton wrote:

> Hello,
>
> I am trying to overlay one xy plot onto another using the overlay function. Both plots have explicit tick marks and labels on the x-axis. When I overlay the plots, the tick marks and labels from the base plot show up but the ones from the transform plot do not. The data from the transform plot is plotted though.
>
> I have included a plot of what I am trying to achieve (ncl-help_draw). This was plotted without using overlay, but since I later wish to panel several plots I cannot call draw. I have also included the result from using the overlay function (ncl-help_overlay) and also what the individual plots look like (ncl-help_separate). The script used to produce ncl-help_overlay is also attached.
>
> Thank you for your help,
>
> Kay Shelton
> <ncl-help_draw.pdf><ncl-help_overlay.pdf><ncl-help_separate.pdf><ncl-help.ncl>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jun 23 15:26:27 2010

This archive was generated by hypermail 2.1.8 : Thu Jun 24 2010 - 14:10:27 MDT