<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<div id="Signature">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px"><b></b></div>
</div>
</div>
<div dir="ltr" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<div>
<p>Thanks for the reply<br>
</p>
<p><br>
</p>
<p>The first suggestion doesnot work for me but the second one does .I dont exactly know the reason.<br>
</p>
<p><br>
</p>
<p>Secondly when I used <span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; background-color:rgb(255,255,255)">u1@_FillValue =-99</span> in the plot it removed the value -99 from the variable but now when I am trying to print it in
ASCII format this value does not go away .<br>
</p>
<p><br>
</p>
<p>I would also like to know is there a replica for WRF function wrf_user_ll_to_ij to lock the location in the netcdf files which do not have (MAP_PROJ),(TRUELAT1),(DX),(DY) etc included in the file or this requires to write a new code or a function .<br>
</p>
<p><br>
</p>
<p>The problem as I stated before is to compare the WRF output and that of the instrument at the particular location whereas the output from the instrument is in the netcdf file . I am cleaning the code as advised by david and trying to compare the data with
time in the right format but am not successful yet .Any help will be much appreciated.<br>
</p>
<p><br>
</p>
<div id="Signature">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px"><b><br>
</b></div>
<div style="font-family:Tahoma; font-size:13px"><b>Regards</b></div>
<div style="font-family:Tahoma; font-size:13px"><b>Muhammad Omer Mughal</b>
<div><b>Department of Applied Physics</b></div>
<div><br>
</div>
</div>
</div>
</div>
<div style="color:rgb(33,33,33)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> David Brown <dbrown@ucar.edu><br>
<b>Sent:</b> Wednesday, 20 August 2014 5:56 PM<br>
<b>To:</b> Muhammad Omer Mughal<br>
<b>Cc:</b> ncl-talk@ucar.edu<br>
<b>Subject:</b> Re: [ncl-talk] FW: Problem in writing the output from netcdf file</font>
<div> </div>
</div>
<div>
<div dir="ltr">In addition to what Dennis has pointed out, the thing that seems problematic to me is that you have used 'addfiles' in a loop to open individual files.
<div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
do j = 0,numfils-1,1<br>
a = addfiles(fils(j)+".nc","r")<br>
time=a[:]->time</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
u1=a[:]->vrect_x(:,:,:)<br>
u1@_FillValue =-99</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
v1=a[:]->vrect_y(:,:,:)<br>
v1@_FillValue =-99<br>
</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
ntim = dimsizes(time)<br>
end do</div>
</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
<br>
</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
This is not how addfiles is used normally. It can open all the files at once. Eliminate the do loop and use:</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
<br>
</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
a = addfiles(fils + ".nc","r")</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
<br>
</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
Otherwise if you want to keep the loop use "addfile" and eliminate the list-type syntax (the brackets [:]).</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
-dave</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
<br>
</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
<br>
</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
<br>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Aug 20, 2014 at 7:17 AM, Dennis Shea <span dir="ltr">
<<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>The email text you wrote does not agree with the script you included.<br>
<br>
</div>
[1] Please clean the script coding so it is nicely formatted. People do not have time to unravel code.<br>
<br>
</div>
[2] As noted frequently on ncl-talk, users should include output from printVarSummary(...)<br>
</div>
for selected variables. This is not just for ncl-talk to examine but also you. Please<br>
</div>
<div> examine the output.<br>
</div>
<div><br>
</div>
[3] The email text states "The netcdf files are from the instrument but are not in the regular
<br>
<div class=""> netcdf format meaning that the time is not included in the dimensions of the variables
<br>
</div>
to be extracted". This is not clear.<br>
<br>
</div>
Yet your code has<br>
<br>
u1 = a[:]->vrect_x ; (:,:,:)<br>
<br>
</div>
and subsequently<br>
<br>
data(npt) = data(npt) + sprintf("%7.1f ",u1(nt,nl,ml))<br>
<br>
</div>
where u1 references a time dimension via subscrip 'nt' . Very confusing.<br>
<br>
</div>
[4] You use<br>
<br>
x = (/ntim,nlat,mlon/)<br>
<br>
</div>
If you were to use<br>
<br>
</div>
printVarSummary(x)<br>
<br>
</div>
you would see that it is a one dimensional array of tyope integer and length 3.<br>
<br>
</div>
Later you use<br>
<br>
data(npt) = data(npt) + sprintf("%10.3f ", x(nt))<br>
<br>
</div>
why x(nt)????<br>
<br>
<br>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div><br>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div>
<div class="h5">On Tue, Aug 19, 2014 at 11:52 PM, Muhammad Omer Mughal <span dir="ltr">
<<a href="mailto:m.mughal1@postgrad.curtin.edu.au" target="_blank">m.mughal1@postgrad.curtin.edu.au</a>></span> wrote:<br>
</div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div class="h5">
<div dir="ltr" style="font-size:12pt; color:#000000; background-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><br>
</p>
<div dir="ltr" style="font-size:12pt; color:#000000; background-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif">
<div>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
Hi everyone</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
I am running NCL version 6.1.0. I have to write output from multiple netcdf file into the ascii fromat containing wind speed comparison at a particular latitude and longitude.This aim is to get the comparison from the wrf ouput and the instrument at a particular
location. The netcdf files are from the instrument but are not in the regular netcdf format meaning that the time is not included in the dimensions of the variables to be extracted and each file contains one value of time.The first problem that I am facing
is that the fill value is not getting deleted in the ascii output.I use the following to generated the ascii output .<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
b=addfile("/20090711/<a href="http://20090711_000239_01_g.nc" target="_blank">20090711_000239_01_g.nc</a>","r")<br>
lon=b->yp(0,0,:)<br>
lat=b->xp(0,:,0)</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
DATADir = "./"<br>
fils = systemfunc (" ls -1 " + DATADir + "/20090711* ") <br>
numfils = dimsizes(fils) <br>
do j = 0,numfils-1,1<br>
a = addfiles(fils(j)+".nc","r")<br>
time=a[:]->time</div>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
::::::::::::::</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
::::::::::<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
npt = npt + 1 <br>
data(npt) = sprinti("%0.5i", (npt+1) ) <br>
data(npt) = data(npt) + sprintf("%7.1f ",lat(nl))<br>
data(npt) = data(npt) + sprintf("%7.1f ",lon(ml))</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
do nt=0,ntim-1<br>
data(npt) = data(npt) + sprintf("%10.3f ", x(nt))</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
data(npt) = data(npt) + sprintf("%7.1f ",u1(nt,nl,ml))</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
data(npt) = data(npt) + sprintf("%7.1f ",v1(nt,nl,ml))<br>
end do<br>
end do<br>
end do<br>
asciiwrite (fName , data)</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; margin-top:0px; margin-bottom:0px">
In this way I get the output that is attached .<span style="font-family:Tahoma; font-size:13px">Any help to correct this code will be appreciated</span></div>
<p><br>
</p>
<p><br>
</p>
<div>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px"><b><br>
</b></div>
<div style="font-family:Tahoma; font-size:13px"><b>Regards</b></div>
<span><font color="#888888">
<div style="font-family:Tahoma; font-size:13px"><b>Muhammad Omer Mughal</b>
<div><b>Department of Applied Physics</b></div>
<div><br>
</div>
</div>
</font></span></div>
</div>
</div>
</div>
</div>
<br>
</div>
</div>
_______________________________________________<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>
<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>
</div>
</div>
</div>
</div>
</body>
</html>