Thank you Muhammad.<div><br></div><div>That did the trick!<br><br><div class="gmail_quote">On 16 December 2010 15:33, Muhammad Rahiz <span dir="ltr"><<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk">muhammad.rahiz@ouce.ox.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
<br>
-- <br>
Muhammad Rahiz<br>
Researcher & DPhil Candidate (Climate Systems & Policy)<br>
School of Geography & the Environment<br>
University of Oxford<br>
<br></div><div class="im">
On Thu, 16 Dec 2010, James Ciarlo` wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear Muhammad,<div class="im"><br>
The problem with the nc file is now solved thank you. I will contact the RegCNET to understand<br>
better the process that produces the nc files so that I can understand the problem with that<br>
file.<br>
The processing that I was doing was from the ESRL web site, to obtain a select region and time<br>
frame. But that I can do with GrADS so it is not a problem.<br>
<br>
Regarding the fprintf. I need to <br>
sdfopen <a href="http://input.nc" target="_blank">input.nc</a><br>
set lon x<br>
set lon y<br>
set lev z #so one value for each, one point in the map<br>
set t 1 150 #so basically I am setting a time line<br>
d prmsl # this gives me a graph of pressure v time<br>
#Then from fprintf I need to get the values for both pressure and time<br>
I use 'frpintf prmsl data.txt' to get the pressure values<br>
But then I need to get the corresponding time values, even in a separate text document, it<br>
doesn't matter, as long as I can get it.<br>
</div></blockquote>
<br>
It seems that you want to extract the timeseries of a particular grid point. The attached script would do that (items marked with ** needs to be changed to suit your data).<br>
<br>
What it does is to make a loop, and prints out two text files - one for data, and one for time stamp.<br>
<br>
Once you get the two text files out, you can join them together using the command<br>
<br>
$ paste x.time.txt x.data.txt > x.output.txt<br>
<br>
The timestamp that I have for my file is something like 12Z28JAN2061. You may want to remove unwanted characters like 12Z so that it becomes 28JAN2061. To do so, run<br>
<br>
$ sed -i 's/12Z//g' x.time.txt<div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
DO you think it's possible?<br>
<br>
James<br>
<br>
On 15 December 2010 16:16, Muhammad Rahiz <<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk" target="_blank">muhammad.rahiz@ouce.ox.ac.uk</a>> wrote:<br>
<br>
<br>
--<br>
Muhammad Rahiz<br>
Researcher & DPhil Candidate (Climate Systems & Policy)<br>
School of Geography & the Environment<br>
University of Oxford<br>
<br>
On Wed, 15 Dec 2010, James Ciarlo` wrote:<br>
<br>
Dear Muhammad,<br>
A) I have sent you the nc file for file3.jpg, but I cannot send you the nc<br>
file for file1.jpg<br>
and file2.jpg as it is 35 GB large. Perhaps we can figure it out through<br>
this one?<br>
<br>
<br>
The attached ESRL_SLP.nc file has undergone some processing. You can look at the history<br>
of commands on the file by<br>
<br>
$ ncdump -h ESRL_SLP.nc<br>
<br>
I went the source of the data at<br>
<a href="http://www.esrl.noaa.gov/psd/data/gridded/data.20thC_ReanV2.monolevel.mm.html" target="_blank">www.esrl.noaa.gov/psd/data/gridded/data.20thC_ReanV2.monolevel.mm.html</a> and downloaded<br>
the file <a href="http://prmsl.mon.mean.nc" target="_blank">prmsl.mon.mean.nc</a> (it is the same file you have judging from the file history).<br>
I then made a test plot in GrADs (see prmsl.png). Plots fine.<br>
<br>
As I said, some processing was done on the file you have. I don't know exactly what<br>
language (I suspect NCL) and what it's trying to do. Perhaps you can tell what is it<br>
that you're trying to do with the file, I could possibly help.<br>
<br>
<br>
B) I have set up the script <a href="http://fprintf.gs" target="_blank">fprintf.gs</a> and have managed to get it<br>
operational. It works well<br>
and I thank you for it. I haven't been able to produce the text for time and<br>
elevation though.<br>
I tried the same procedure as you mentioned for lon.txt and lat.txt for<br>
time, but it didn't<br>
work? does it require another script or maybe a different way to define<br>
time?<br>
<br>
<br>
I'm not sure what you mean by wanting to get the ascii grid for time. Each ascii that<br>
you generate corresponds to a particular time. Hence if you want to get ascii grids for<br>
all time steps, just do something like<br>
<br>
'sdfopen <a href="http://input.nc" target="_blank">input.nc</a>'<br>
'set t 1'<br>
'd prmsl'<br>
'fprintf prmsl prmsl.t1.txt'<br>
<br>
'set t 2'<br>
'd prmsl'<br>
'fprintf prmsl prmsl.t2.txt'<br>
<br>
Of course, you can do this in a loop for all time steps.<br>
<br>
I'm not sure if elevation (topography) is a variable of climate data (I've not come<br>
across any). Do you mean pressure levels like 500mb, 100mb etc? If yes, then you can do;<br>
<br>
'set lev 500'<br>
'set t 1'<br>
'd prmsl'<br>
'fprintf prmsl prmsl.time1.lev500.txt'<br>
<br>
This gives you the data for 500mb pressure level at time, t=1.<br>
<br>
<br>
<br>
Regards,<br>
<br>
James<br>
<br>
On 15 December 2010 10:46, Muhammad Rahiz <<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk" target="_blank">muhammad.rahiz@ouce.ox.ac.uk</a>><br>
wrote:<br>
Hi James,<br>
<br>
I suspect a corrupted data file. Could you attach the original<br>
datafile, if it's<br>
not too big? And attach the commands that you use to plot as well.<br>
<br>
--<br>
Muhammad Rahiz<br>
Researcher & DPhil Candidate (Climate Systems & Policy)<br>
School of Geography & the Environment<br>
University of Oxford<br>
<br>
On Wed, 15 Dec 2010, James Ciarlo` wrote:<br>
<br>
Dear Muhammad,<br>
I am sorry it took me so long to answer. Thank you for your<br>
answer on point 2. <br>
<br>
Regarding point 1, opening .nc files. I have attached some<br>
files. <br>
The images from file1.jpg and file2.jpg are grads images<br>
(printim) from nc files produced with RegCM4, one is gxout<br>
contour and the other is gxout shaded.<br>
The image from file3.jpg is a grads image (printim) gxout shaded<br>
for an nc file from the ESRL database. <br>
The last image was produced with the PANOPLY data viewer from<br>
the same file that produced file3.jpg<br>
<br>
As you can see the data is not being plotted with grads as with<br>
normal .ctl files (which are working properly).<br>
I cannot seem to understand why it is not reading it properly.<br>
Maybe there are some definitions that I have to set? How should<br>
I check if all the settings are correct?<br>
<br>
Regarding point 3, I think I can do them as a normal<br>
mathematical expression, but I'll be trying that later on. <br>
<br>
Regards,<br>
<br>
James<br>
<br>
On 11 December 2010 12:24, James Ciarlo`<br>
<<a href="mailto:james.ciarlo@physics.org" target="_blank">james.ciarlo@physics.org</a>> wrote:<br>
Dear Muhammad,<br>
I just had a look at it this morning. Unfortunately I<br>
haven't yet had the time to put it to use. Thank you very<br>
much for your help. I will get back to you about it for<br>
sure. Thanks again<br>
<br>
Regards,<br>
<br>
James<br>
<br>
<br>
On 11 December 2010 09:59, Muhammad Rahiz<br>
<<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk" target="_blank">muhammad.rahiz@ouce.ox.ac.uk</a>> wrote:<br>
Hi James,<br>
I was wondering if you got my reply to the<br>
query you posted because I'm not sure if it<br>
gets delivered successfully.<br>
<br>
Anyway, if you did not, these are what I<br>
suggested<br>
<br>
1. display error<br>
- Try set gxout to something other than the<br>
default e.g. set gxout grfill<br>
- set clevs<br>
- check units<br>
<br>
2. print to ascii<br>
what you need is the <a href="http://fprintf.gs" target="_blank">fprintf.gs</a> script<br>
available<br>
athttp://<a href="http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Savi" target="_blank">cookbooks.opengrads.org/index.php?title=Recipe-002:_Savi</a><br>
<br>
ng_GrADS_variable_data_to_a_text_file<br>
<br>
Copy the code and name the file as <a href="http://fprintf.gs" target="_blank">fprintf.gs</a>.<br>
Then do the following,<br>
<br>
sdfopen <a href="http://input.nc" target="_blank">input.nc</a><br>
d var # where var = variable<br>
fprintf var dat.txt # prints data of var<br>
fprintf lon lon.txt # prints corresponding<br>
lon<br>
fprintf lat lat.txt # prints corresponding<br>
lat<br>
<br>
3. statistical analysis<br>
I know how to do so in R. If you're interested<br>
in using R for this purpose, I can help.<br>
<br>
HTH,<br>
<br>
--<br>
Muhammad Rahiz<br>
Researcher & DPhil Candidate (Climate Systems<br>
& Policy)<br>
School of Geography & the Environment<br>
University of Oxford<br>
<br>
On Fri, 10 Dec 2010, James Ciarlo` wrote:<br>
<br>
Dear all,<br>
I am using GrADS 2.0.a9 on LINUX. I am<br>
trying to compare measured and modelled<br>
data by using GrADS. However since I am<br>
new with the program, there are<br>
some issues that I cannot seem to figure<br>
out, or find a solution to understand.<br>
I am experiencing:<br>
<br>
1) Difficulty with displaying data from<br>
NetCDF files<br>
I have opened the file with the command<br>
'sdfopen'<br>
When I tried 'd prmsl' I got the<br>
following error:<br>
Operation error: Invalid dimension<br>
environment<br>
Min longitude > max longitude: 320 144<br>
So I used ' set lon -40 145' and tried<br>
the display command again<br>
I got the following line and the image<br>
attached (ncimage.jpg):<br>
Contouring: 99000 to 102300 interval 300<br>
And I am getting similar results with<br>
other nc files<br>
<br>
2) Difficulty with finding a command to<br>
output text files, or dat, or anything<br>
similar.<br>
I have used set lat, set lon, and set<br>
lev to obtain one value, and set t to<br>
get a long time interval, I have used d<br>
psa to display the time series, I<br>
can use printim file.jpg to get an<br>
image, but I cannot find a command to<br>
produce a file.txt so that I can make<br>
use of the actual numbers for<br>
statistical purposes.<br>
<br>
3) Difficulty with finding a command to<br>
work out comparative statistics,<br>
particularly correlation and<br>
significance.<br>
<br>
Regards,<br>
<br>
James Ciarlo`<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
</div></div></blockquote></div><br></div>