Re: modify wrfinput

From: jam hong <cumarporn_at_nyahnyahspammersnyahnyah>
Date: Thu, 8 Oct 2009 23:19:33 +0000

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: 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 Huanghuangwei_at_ucar.eduVETS/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")

  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_cnFillOn = 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.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
--_d7ec4a8e-012f-46f3-ab5d-1a238d21e414_
Content-Type: text/html; charset="windows-1256"
Content-Transfer-Encoding: 8bit

<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
<br>Dear all<br>I have been modified wrfinput file. I changed to 'w' already but all the values turning to 0 in the file though.<br>How can I fixed it?<br>Thanks<br>Jam<br><br><br><br><br><br>(0,37,180)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,181)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,182)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,183)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,184)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,185)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,186)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,187)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,188)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,189)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,190)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,191)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>(0,37,192)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br><br><hr id="stopSpelling">CC: ncl-talk_at_ucar.edu<br>From: huangwei_at_ucar.edu<br>To: cumarporn_at_hotmail.com<br>Subject: Re: [n
 cl-talk] modify wrfinput<br>Date: Mon, 5 Oct 2009 20:33:53 -0600<br><br>Jam Hong,<div><br></div><div>The error message tells you clearly that you opened your file for read only.</div><div>To write back to that file, you need to open the file with write permission.</div><div><br></div><div>Change line:</div><div><blockquote><span class="ecxApple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div class="ecxhmmessage" style="font-size: 10pt; font-family: Verdana;">a=addfile("wrfinput_d01_ihop.nc","r")</div></span></blockquote>to:</div><div><blockquote><span class="ecxApple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant:
  normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div class="ecxhmmessage" style="font-size: 10pt; font-family: Verdana;">a=addfile("wrfinput_d01_ihop.nc","w")</div></span></blockquote><div><br></div><div>Regards,</div><br><div> <span class="ecxApple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style=""><span class="ecxApple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-
 spacing: 0px;"><div style=""><span class="ecxApple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style=""><div><div>Wei Huang</div><div><a href="mailto:huangwei_at_ucar.edu">huangwei_at_ucar.edu</a></div><div>VETS/CISL<br>National Center for Atmospheric&nbsp;Research<br>P.O. Box 3000 (1850 Table Mesa Dr.)<br>Boulder, CO 80307-3000 USA<br>(303) 497-8924</div></div><div><br></div></div></span><br class="ecxApple-interchange-newline"></div></span><br class="ecxApple-interchange-newline"></div></span><br class="ecxApple-interchange-newline"> </div><br><div><div>On Oct 5, 2009, at 5:40 PM, jam hong wrote:</div><br class="ecxApple-interchange-newline"><blockquote><span class="ecxApple-style-span" style="border-collapse: separat
 e; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div class="ecxhmmessage" style="font-size: 10pt; font-family: Verdana;">Dear NCL users<br>I try to modify some grid points in the wrf_input file.<br>I got the error message that I could not write the file<br><br>fatal:FileWriteVar: file (wrfinput_d01_ihop) was opened for reading only, can not write<br>fatal:Execute: Error occurred at or near line 26 in file modifync.ncl<br><br><span id="ecxtoBoxCc" style="display: block;"><span class="ecxBlockEmailNoName"></span></span>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"<br><br>begin<br>&nbsp; a=addfile("wrfinput_d01_ihop.nc","r")<br><br>&nbs
 p; lat = a-&gt;XLAT(0,:,:)<br>&nbsp; lon = a-&gt;XLONG(0,:,:)<br>&nbsp; dimll = dimsizes(lat)<br>&nbsp; nlat = dimll(0)<br>&nbsp; nlon = dimll(1)<br><br>&nbsp; wks = gsn_open_wks("x11","plt_wrfinput")^M<br>&nbsp; gsn_define_colormap(wks,"gui_default")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; choose colormap^M<br>dimS = filevardimsizes(a," VEGFRA")<br>&nbsp; print(dimS)<br>&nbsp; ;veg = wrf_user_getvar(a,"VEGFRA",it)<br>&nbsp; ;print(dimsizes(veg))<br>&nbsp; ;print(veg)<br>&nbsp; fld = a-&gt;VEGFRA&nbsp; !!<span class="ecxApple-converted-space">&nbsp;</span><font color="#ff0000">This line caused the problem how can I rewrite data to the file</font><br><br>;&nbsp; print(fld)<br>&nbsp; do i = 0,199<br>&nbsp;&nbsp; do j = 0,120<br>&nbsp;&nbsp;&nbsp;&nbsp; fld = fld * 0.5<br>&nbsp;&nbsp; end do<br>&nbsp; end do<br>&nbsp; a-&gt;VEGFRA=(/fld/)<br>&nbsp;<span class="ecxApple-converted-space">&nbsp;</span><br>res = True<br><br>&nbsp; res_at_gsnAddCyclic = False&nbsp;&nbsp;&nbsp;&nbsp
 ;&nbsp;&nbsp;&nbsp; ; false since data does not cover globe<br>&nbsp; res_at_tfDoNDCOverlay&nbsp; = True&nbsp;&nbsp;&nbsp; ; faster for native projection<br><br>&nbsp; res_at_mpProjection = "LambertConformal"<br>&nbsp; res_at_mpLambertParallel1F = a_at_TRUELAT1<span class="ecxApple-converted-space">&nbsp;</span><br>&nbsp; res_at_mpLambertParallel2F = a_at_TRUELAT2<span class="ecxApple-converted-space">&nbsp;</span><br>&nbsp; res_at_mpLambertMeridianF&nbsp; = a_at_STAND_LON<br>&nbsp; res_at_mpLimitMode = "Corners"<br>&nbsp; res_at_mpLeftCornerLatF = lat(0,0)<br>&nbsp; res_at_mpLeftCornerLonF = lon(0,0)<br>&nbsp; res_at_mpRightCornerLatF = lat(nlat-1,nlon-1)<br>&nbsp; res_at_mpRightCornerLonF = lon(nlat-1,nlon-1)<br><br>&nbsp; res_at_mpOutlineDrawOrder = "PostDraw"&nbsp; ; draw continental outline last<br>&nbsp; res_at_mpOutlineBoundarySets = "GeophysicalAndUSStates"<br>&nbsp; res_at_mpFillOn = False&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; turn off map fill<br><br>&nbsp; res_at_pmTickMarkDisplayMode = "Always"<br><br>&nbsp; res_at_cnFill
 On&nbsp;&nbsp;&nbsp; = True&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; turn on color fill<br>&nbsp; res_at_cnLinesOn&nbsp;&nbsp; = False&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; turn off the contour lines<br>&nbsp; res_at_cnLineLabelsOn = False&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; turn the line labels off<br>&nbsp; res_at_cnFillMode = "RasterFill"<br>&nbsp;<br>&nbsp; plot = gsn_csm_contour_map(wks,fld(0,:,:),res)<span class="ecxApple-converted
 -space">&nbsp;</span><br><br>end<br><br><br><hr>Windows Live:<span class="ecxApple-converted-space">&nbsp;</span>Friends get your Flickr, Yelp, and Digg updates when they e-mail you.<span class="ecxApple-converted-space">&nbsp;</span>_______________________________________________<br>ncl-talk mailing list<br>List instructions, subscriber options, unsubscribe:<br>http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br></div></span></blockquote></div><br></div> <br /><hr />Windows Live: <a href='http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010' target='_new'>Friends get your Flickr, Yelp, and Digg updates when they e-mail you.</a></body>
</html>
--_d7ec4a8e-012f-46f3-ab5d-1a238d21e414_--

--===============2090226946==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============2090226946==--
Received on Thu Oct 08 2009 - 17:19:33 MDT

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