Re: contouring water vapor (g/kg) with RUC data

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Jan 21 2014 - 14:06:52 MST

Hi Brian,

Thanks for your patience on this.

The problem is that the variable you are passing to gsn_csm_contour doesn't have any coordinate array information attached to it, and you are not setting any coordinate information via lat2d / lon2d or via sfXArray / sfYArray. This means that NCL will use index values on the X and Y axis for plotting.

Meanwhile, however, the variables being passed to gsn_csm_vector *do* have coordinate information, and therefore their axes are in a completely different data space than the contours.

I see that for the U/V variables, you are reading in the lat/lon information and turning them in coordinate arrays:

        lat = XLAT(:,0)
        lon = XLONG(0,:)
        lat@units = "degrees_north"
        lon@units = "degrees_east"
        lat!0 = "lat"
        lon!0 = "lon"
        lat&lat = lat
        lon&lon = lon

         u_plane!0 = "lev"
         u_plane!1 = "lat"
         u_plane!2 = "lon"
         u_plane&lev = lev
         u_plane&lat = lat
         u_plane&lon = lon

You have to be careful with this, because you are making the assumption that XLAT and XLONG are rectilinear (that is, the XLAT values repeat along each longitude index, and the XLONG values repeat along each latitude index). This doesn't appear to be the case with your lat/lon values.

Instead of turning these variables into 1D coordinate arrays, I recommend using the special lat2d/lon2d attributes, and removing all the code that does the coordinate array attaching:

; Comment or remove all of these lines:
; lat = XLAT(:,0)
; lon = XLONG(0,:)
; lat@units = "degrees_north"
; lon@units = "degrees_east"
; lat!0 = "lat"
; lon!0 = "lon"
; lat&lat = lat
; lon&lon = lon
;
; u_plane!0 = "lev"
; u_plane!1 = "lat"
; u_plane!2 = "lon"
; u_plane&lev = lev
; u_plane&lat = lat
; u_plane&lon = lon

and add these lines:

          u_out_200@lat2d = XLAT
          u_out_200@lon2d = XLONG
          v_out_200@lat2d = XLAT
          v_out_200@lon2d = XLONG

The gsn_csm_xxxxx routines look for the special lat2d/lon2d attributes, and will use this information to do the correct thing with your X and Y axes.

You need do this lat2d/lon2d stuff for *every* variable you want to plot, including "qvap_out_200", "qvap_out_300", etc.

--Mary

On Jan 14, 2014, at 9:50 AM, brianjs @iastate.edu <brianjs@iastate.edu> wrote:

> Good Afternoon,
>
> I am attempting to plot water vapor mixing ratio (calculated to be in g/kg) contoured with wind barbs. Unfortunately, I cannot get the contours to appear. I am using the same exact routine that I did for contouring wind magnitudes (which contours just fine).
>
> The only difference is that my water vapor mixing ratio variable (qvap) has to be calculated instead of being drawn directly as a variable from the model itself. This should not make a difference though. I checked the status of the qvap variable (using printVarSummary, printMinMax, and print) and the numbers look excellent at all levels, with no missing values or anything else out of the ordinary. By deductive reasoning, it should be easy to contour like the wind magnitude. I honestly do not know what could be wrong with the variable data and why it cannot be contoured. Perhaps the numbers are distributed in such a way that they cannot be contoured properly? Perhaps I need another special resource? I appreciate any input that can be provided.
>
> I am attaching the code with problems contouring the water vapor (ruc_qheight.ncl), as well as the similar code that does work for wind magnitudes (ruc_wheight.ncl) so that they can be compared/contrasted (if necessary). I also imported my data file (via ftp) which is the cat_file.cdf. The images attached are with wind magnitude contours (which works) and qvapor contours (which are missing).
>
> Again, any help would be greatly appreciated.
>
> Brian Squitieri
> Graduate Research Assistant
> Iowa State University
> <qvap_contour00.png><ruc_qheight.ncl><wnd_mag_contour00.png><ruc_wheight.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 Tue Jan 21 14:07:03 2014

This archive was generated by hypermail 2.1.8 : Tue Jan 21 2014 - 15:57:30 MST