Re: modify wrfinput

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 9 Oct 2009 04:24:04 -0600

Jam,

It looks to me like there was something wrong with "VEGFRA" on the
file. But, then, if you've been overwriting it with bad values, then
you need to get the original file back.

By the way, I'm not sure this do loop is correct:
> do i = 0,199
> do j = 0,120
> fld = fld * 0.5
> end do
> end do
You are effectively multiplying the "fld" array by 0.5 23,880 times.

If you just mean to multiply the array *once* by 0.5, then do this
one line:

fld = fld * 0.5

Please check "VEGFRA" on the file to make sure it looks okay. You can
do something like this:

   fld = a->VEGFRA
   printVarSummary(fld)
   print("min/max fld = " + min(fld) + "/" + max(fld))

It's probably better not to write over the original variable until
you know that the values look correct.

--Mary

On Oct 8, 2009, at 5:19 PM, jam hong wrote:

>
> Dear all
> I have been modified wrfinput file. I changed to 'w' already but
> all the values turning to 0 in the file though.
> How can I fixed it?
> Thanks
> Jam
>
>
>
>
>
> (0,37,180) 0
> (0,37,181) 0
> (0,37,182) 0
> (0,37,183) 0
> (0,37,184) 0
> (0,37,185) 0
> (0,37,186) 0
> (0,37,187) 0
> (0,37,188) 0
> (0,37,189) 0
> (0,37,190) 0
> (0,37,191) 0
> (0,37,192) 0
>
> CC: ncl-talk_at_ucar.edu
> From: huangwei_at_ucar.edu
> To: cumarporn_at_hotmail.com
> Subject: Re: [n cl-talk] modify wrfinput
> Date: Mon, 5 Oct 2009 20:33:53 -0600
>
> Jam Hong,
>
> The error message tells you clearly that you opened your file for
> read only.
> To write back to that file, you need to open the file with write
> permission.
>
> Change line:
> a=addfile("wrfinput_d01_ihop.nc","r")
> to:
> a=addfile("wrfinput_d01_ihop.nc","w")
>
> Regards,
>
> Wei Huang
> huangwei_at_ucar.edu
> VETS/CISL
> National Center for Atmospheric Research
> P.O. Box 3000 (1850 Table Mesa Dr.)
> Boulder, CO 80307-3000 USA
> (303) 497-8924
>
>
>
>
>
> On Oct 5, 2009, at 5:40 PM, jam hong wrote:
>
> Dear NCL users
> I try to modify some grid points in the wrf_input file.
> I got the error message that I could not write the file
>
> fatal:FileWriteVar: file (wrfinput_d01_ihop) was opened for reading
> only, can not write
> fatal:Execute: Error occurred at or near line 26 in file modifync.ncl
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>
> begin
> a=addfile("wrfinput_d01_ihop.nc","r")
>
> &nbs p; lat = a->XLAT(0,:,:)
> lon = a->XLONG(0,:,:)
> dimll = dimsizes(lat)
> nlat = dimll(0)
> nlon = dimll(1)
>
> wks = gsn_open_wks("x11","plt_wrfinput")^M
> gsn_define_colormap(wks,"gui_default") ; choose colormap^M
> dimS = filevardimsizes(a," VEGFRA")
> print(dimS)
> ;veg = wrf_user_getvar(a,"VEGFRA",it)
> ;print(dimsizes(veg))
> ;print(veg)
> fld = a->VEGFRA !! This line caused the problem how can I
> rewrite data to the file
>
> ; print(fld)
> do i = 0,199
> do j = 0,120
> fld = fld * 0.5
> end do
> end do
> a->VEGFRA=(/fld/)
>
> res = True
>
> res_at_gsnAddCyclic = False ; ; false since data does not
> cover globe
> res_at_tfDoNDCOverlay = True ; faster for native projection
>
> res_at_mpProjection = "LambertConformal"
> res_at_mpLambertParallel1F = a_at_TRUELAT1
> res_at_mpLambertParallel2F = a_at_TRUELAT2
> res_at_mpLambertMeridianF = a_at_STAND_LON
> res_at_mpLimitMode = "Corners"
> res_at_mpLeftCornerLatF = lat(0,0)
> res_at_mpLeftCornerLonF = lon(0,0)
> res_at_mpRightCornerLatF = lat(nlat-1,nlon-1)
> res_at_mpRightCornerLonF = lon(nlat-1,nlon-1)
>
> res_at_mpOutlineDrawOrder = "PostDraw" ; draw continental outline last
> res_at_mpOutlineBoundarySets = "GeophysicalAndUSStates"
> res_at_mpFillOn = False ; turn off map fill
>
> res_at_pmTickMarkDisplayMode = "Always"
>
> res_at_cnFill On = True ;
> turn on color fill
> res_at_cnLinesOn = False ;
> turn off the contour lines
> res_at_cnLineLabelsOn = False ;
> turn the line labels off
> res_at_cnFillMode = "RasterFill"
>
> plot = gsn_csm_contour_map(wks,fld(0,:,:),res)
>
> end
>
>
> Windows Live: Friends get your Flickr, Yelp, and Digg updates when
> they e-mail you. _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> Windows Live: Friends get your Flickr, Yelp, and Digg updates when
> they e-mail you.
> _______________________________________________
> 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 Fri Oct 09 2009 - 04:24:04 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 09 2009 - 08:29:22 MDT