Re: WRF Time Dimension when displaying Mean (err: 3subscr vs 2expect)

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Sep 30 2013 - 16:01:33 MDT

Hi Jack,

Using the line numbers given in the error message, I found that the error is indeed because you are missing a "time" dimension.

The line it is failing on in WRFUserARW.ncl is:

        lat = in_file->XLAT(map_args@mpNestTime,:,:)

I'm not familiar enough with WRF output files to know whether XLAT/XLONG are *always* supposed to be 3D, so I've CC'ed wrfhelp on this.

Meanwhile, there are three possible work-arounds you can try. I think #3 may be your best bet.

 1. Rewrite the files so that there's a time dimension of length 1. I don't think this is going to get you all the way there, though, because you have write these files correctly in order for the wrf_xxxx plotting functions to work properly.

  2. Copy $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl to your own directory, and modify the offending lines so that they just use:

        lat = in_file->XLAT
        lon = in_file->XLONG

Then, in your own script, change the two load commands to:

> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "./WRFUserARW.ncl"

  Again, though, you may still run into other problems, since your output files may not be "true" WRF output files.

  3. Don't use wrf_xxxx to plot your data, and use gsn_csm_contour_map instead. We have a template for this called "wrf_contour_map_template.ncl" at:

http://www.ncl.ucar.edu/Applications/Templates/

Using the script you included below, I modified this template with your filenames and calculations below. See attached. THIS IS UNTESTED as I don't have anything to test this script on.

Good luck,

--Mary

On Sep 18, 2013, at 11:21 AM, Jack Ritchie <jritchie@ucsd.edu> wrote:

> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>
>
>
> f00 = addfile ("slp00Zbar092000.nc","r")
> f06 = addfile ("slp06Zbar092000.nc","r")
> f12 = addfile ("slp12Zbar092000.nc","r")
> f18 = addfile ("slp18Zbar092000.nc","r")
>
> system("/bin/rm -f slpDAYbar092000.nc")
> ncbr = addfile ("slpDAYbar092000.nc", "c")
>
> vattbs = getvaratts(f00) ; Any Var, inclu file ptr
> vnames = getfilevarnames(f00)
> fdmszs = getfiledimsizes(f00 )
> fdnams = getvardims(f00 )
>
> ; print(" ")
> ; print("------------------------------------getfiledimsizes:-")
> ; print(fdmszs+" "+fdnams)
> ; print("------------------------------------getfiledimsizes:-")
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> ; We generate plots, but what kind do we prefer?
> ; type = "x11"
> type = "pdf"
> ; type = "ps"
> ; type = "ncgm"
> ; type@wkColorModel = "cmyk" ; make output cmyk
>
> wksbr = gsn_open_wks(type,"plt_slpDAYbar")
> gsn_define_colormap(wksbr,"BlAqGrYeOrRe") ; choose colormap
>
>
> ; Set some Basic Plot options
> res = True
> res@MainTitle = "NCL WRF NWBY"
> res@Footer = False
>
> pltres = True
> mpres = True
> mpres@mpGeophysicalLineColor = "Black"
> mpres@mpNationalLineColor = "Black"
> mpres@mpUSStateLineColor = "Black"
> mpres@mpGridLineColor = "Black"
> mpres@mpLimbLineColor = "Black"
> mpres@mpPerimLineColor = "Black"
> mpres@mpGeophysicalLineThicknessF = 2.0
> mpres@mpGridLineThicknessF = 2.0
> mpres@mpLimbLineThicknessF = 2.0
> mpres@mpNationalLineThicknessF = 2.0
> mpres@mpUSStateLineThicknessF = 2.0
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> time = -1 ; only likes -1
>
> XLONG = wrf_user_getvar(f00 ,"XLONG",time) ;
> XLAT = wrf_user_getvar(f00 , "XLAT",time) ;
>
> slp00 = wrf_user_getvar(f00 ,"SLP00",time) ;
> slp06 = wrf_user_getvar(f06 ,"SLP06",time) ;
> slp12 = wrf_user_getvar(f12 ,"SLP12",time) ;
> slp18 = wrf_user_getvar(f18 ,"SLP18",time) ;
>
>
>
> ; slpbr := slp00(:,:) * 0
> ; slp00a := slp00(:,:) * 0
> ; slp06a := slp06(:,:) * 0
> ; slp12a := slp12(:,:) * 0
> ; slp18a := slp18(:,:) * 0
>
> slpbr = slp00(:,:) * 0
> slp00a = slp00(:,:) * 0
> slp06a = slp06(:,:) * 0
> slp12a = slp12(:,:) * 0
> slp18a = slp18(:,:) * 0
>
> slpbr = 100 * ( slp00(:,:) + slp06(:,:) + slp12(:,:) + slp18(:,:) ) / 4
>
>
> slpbr!0 = slp00!0 ;
> slpbr!1 = slp00!1
> slpbr@FieldType = slp00@FieldType
> slpbr@MemoryOrder = slp00@MemoryOrder
> slpbr@description = slp00@description
> slpbr@units = "Pa"
> slpbr@stagger = slp00@stagger
> slpbr@coordinates = slp00@coordinates
>
> XLAT!0 = slp00!0 ;
> XLAT!1 = slp00!1
> XLAT@FieldType = slp00@FieldType
> XLAT@MemoryOrder = slp00@MemoryOrder
> XLAT@stagger = slp00@stagger
>
> XLONG!0 = slp00!0 ;
> XLONG!1 = slp00!1
> XLONG@FieldType = slp00@FieldType
> XLONG@MemoryOrder = slp00@MemoryOrder
> XLONG@stagger = slp00@stagger
>
> optsbr = res
> slpbr@description = "MSLP DAY SEP 2000"
> slpbr@units = "Pa"
> optsbr@cnLineColor = "Black"
> optsbr@cnFillOn = True
> optsbr@ContourParameters = (/ 100.0 /)
> optsbr@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label
> information
> optsbr@gsnContourLineThicknessesScale = 2.0
>
> contour_slpbrF = wrf_contour(f00,wksbr,slpbr(:,:),optsbr)
>
> optsbr@cnFillOn = False
> optsbr@cnLineColor = "grey42"
> optsbr@ContourParameters = (/ 100.0 /)
> optsbr@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label
> information
> optsbr@gsnContourLineThicknessesScale = 2.0
>
> contour_slpbrL = wrf_contour(f00,wksbr,slpbr(:,:),optsbr)
>
>
> plot =
> wrf_map_overlays(f00,wksbr,(/contour_slpbrF,contour_slpbrL/),pltres,mpres)
>
>
>
> print(" ")
> print("--------------------------------END Sum slpbr ")
> printVarSummary (slpbr)
> printMinMax (slpbr,True)
> print("------")
>
> print(" ")
> print("--------------------------------END Sum XLAT ")
> printVarSummary (XLAT)
> printMinMax (XLAT,True)
> print("------")
>
> print(" ")
> print("--------------------------------END Sum XLONG ")
> printVarSummary (XLONG)
> printMinMax (XLONG,True)
> print("------")
>
> delete(optsbr)

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Mon Sep 30 16:01:46 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 01 2013 - 14:41:43 MDT