<div dir="ltr"><div><div><div><div><div>You should include the output from <br> printVarSummary(eamp)<br><br></div>and compare with<br> printVarSummary(tide_Pamp)<br><br></div>A guess is that you need to use<br><br></div> copy_VarCoords(eamp, tide_Pamp)<br><br></div> printBarSummary(tide_Pamp)<br><br></div>Good Luck<br><div><div><div><div><div><br><br><br></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 30, 2015 at 6:05 PM, 朱学明 <span dir="ltr"><<a href="mailto:557xiaozhu@163.com" target="_blank">557xiaozhu@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><u></u>
<div style="BORDER-LEFT-WIDTH:0px;BORDER-RIGHT-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;MARGIN:12px;LINE-HEIGHT:1.3;BORDER-TOP-WIDTH:0px" marginwidth="0" marginheight="0"><u></u>
<div><font color="#000000" size="3" face="宋体">Hello all,</font></div>
<div><font color="#000000" size="3"></font> </div>
<div><font color="#000000" size="3"> I have got a warning and
error with the code as follow. I want to add two new variables, tide_Pamp and
tide_Pphase, to the existed file. What is the problem with my NCL code?
</font></div>
<div><font color="#000000" size="3"></font> </div>
<div><font color="#000000" size="3"> Any
suggestion?</font></div>
<div><font color="#000000" size="3"></font> </div>
<div>warning:Right hand side has no coordinate variable can not delete
coordinate variable of a file, use (/ .. /) to avoid this
message<br>warning:["Execute.c":8128]:Execute: Error occurred at or near line 60
in file tidepot.ncl</div>
<div> </div>
<div>warning:Right hand side has no coordinate variable can not delete
coordinate variable of a file, use (/ .. /) to avoid this
message<br>warning:["Execute.c":8128]:Execute: Error occurred at or near line 61
in file tidepot.ncl</div>
<div> </div>
<div> </div>
<div>begin<br> Lp = 987 ;474 ;xi_rho<br> Mp = 795 ;482
;eta_rho<br>; Lp = 542<br>; Mp = 770</div>
<div> </div>
<div> pots = asciiread("scs_8con.dat", (/Mp,Lp,16/), "float")<br>;
pots = asciiread("Bering_8con.dat", (/Mp,Lp,16/), "float")</div>
<div> </div>
<div> fname = "<a href="http://scs_tide_20000101.nc" target="_blank">scs_tide_20000101.nc</a>"<br> ncid = addfile(fname,
"w")<br> Ntc = 8<br> eamp=ncid->tide_Ephase<br> tide_Pamp =
new(dimsizes(eamp), typeof(eamp),"No_FillValue")<br> tide_Pphase =
new(dimsizes(eamp),typeof(eamp),"No_FillValue")<br>; tide_Pphase =
new((/Ntc, Mp, Lp/), double)<br>
printVarSummary(tide_Pamp)<br> printVarSummary(pots)<br>; Fill in
the values<br>; ROMS order is q1, o1, p1, k1, n2, m2, s2, k2 while the input
file is <br>; q1, o1, p1, k1, n2, m2, s2, k2 in amplitude, phase pairs<br>
tide_Pamp(0,:,:) = pots(:,:,0)<br> tide_Pamp(1,:,:) =
pots(:,:,2)<br> tide_Pamp(2,:,:) = pots(:,:,4)<br> tide_Pamp(3,:,:)
= pots(:,:,6)<br> tide_Pamp(4,:,:) = pots(:,:,8)<br>
tide_Pamp(5,:,:) = pots(:,:,10)</div>
<div> tide_Pamp(6,:,:) = pots(:,:,12)<br> tide_Pamp(7,:,:) =
pots(:,:,14)<br> tide_Pphase(0,:,:) = pots(:,:,1)<br>
tide_Pphase(1,:,:) = pots(:,:,3)<br> tide_Pphase(2,:,:) =
pots(:,:,5)<br> tide_Pphase(3,:,:) = pots(:,:,7)<br>
tide_Pphase(4,:,:) = pots(:,:,9)<br> tide_Pphase(5,:,:) =
pots(:,:,11)<br> tide_Pphase(6,:,:) = pots(:,:,13)<br>
tide_Pphase(7,:,:) = pots(:,:,15)</div>
<div> </div>
<div> tide_Pamp!0 = "tide_period"<br> tide_Pamp!1 =
"eta_rho"<br> tide_Pamp!2 = "xi_rho"<br> tide_Pphase!0 =
"tide_period"<br> tide_Pphase!1 = "eta_rho"<br> tide_Pphase!2 =
"xi_rho"<br> printVarSummary(tide_Pamp)</div>
<div> </div>
<div> <a href="mailto:tide_Pamp@units" target="_blank">tide_Pamp@units</a> =
"meter"<br> <a href="mailto:tide_Pamp@long_name" target="_blank">tide_Pamp@long_name</a> =
"tidal potential elevation amplitude"<br> <a href="mailto:tide_Pamp@field" target="_blank">tide_Pamp@field</a> = "tide_Eamp,
scalar"<br> <a href="mailto:tide_Pphase@units" target="_blank">tide_Pphase@units</a> =
"degrees, time of maximum elevation with respect chosen time origin"<br>
<a href="mailto:tide_Pphase@long_name" target="_blank">tide_Pphase@long_name</a> = "tidal
potential elevation phase angle"<br> <a href="mailto:tide_Pphase@field" target="_blank">tide_Pphase@field</a> = "tide_Ephase,
scalar"</div>
<div> </div>
<div>; global attributes<br> fileAtt = True<br> <a href="mailto:fileAtt@history" target="_blank">fileAtt@history</a> = "adding potential
tides"<br> fileattdef(ncid, fileAtt)</div>
<div> </div>
<div>; Write to file<br> ncid->tide_Pamp = tide_Pamp<br>
ncid->tide_Pphase = tide_Pphase</div>
<div> </div>
<div>end<br></div>
<div> </div>
<div align="left"><font color="#c0c0c0" face="Verdana">2015-01-30</font></div><font face="Verdana">
<hr style="min-height:2px;WIDTH:122px" align="left" size="2">
</font>
<div><font color="#c0c0c0" face="Verdana"><span>
<u></u>
<div>
<u></u>
<div>
<div>
<div><font face="Times New Roman">Xueming Zhu 朱学明<br>Key Laboratory of Research
on Marine Hazards Forecasting (LoMF), SOA<br>National Marine Environmental
Forecasting Center (NMEFC)<br>No.8, Dahuisi Road, Haidian District, Beijing,
100081<br>People's Republic of
China<br>Tel:<a href="tel:%2B86-10-82481923" value="+861082481923" target="_blank">+86-10-82481923</a></font></div></div></div><u></u></div><u></u></span></font></div><u></u></div></div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>