Dear Eric,<br><br><span id="result_box" class="long_text"><span title="um novo arquivo foi criado depois que fiz as mudanças que voce sugeriu.">a new file was created after I made the changes you suggested. </span><span title="Nenhum erro apareceu">I got no message error.<br>
</span><span style="background-color: rgb(255, 255, 255);" title="No entanto, para garantir que o arquivo de saida está correto eu usei o mesmo .ctl, porém eu modifiquei os comandos "dset", "tdef" e "vars", a fim de respeitar a sintaxe.">However,
to ensure that the output file is correct I used the same .ctl, but I made some changes to the commands "dset", "tdef" and "vars" in order to determine
the correct syntax.<br></span><span title="Entao a figura plotada pelo grads nao mostrou a distribuição correta do vento zonal.">Then the figure plotted by grads it showed a strange zonal wind </span></span><span id="result_box" class="long_text"><span title="Entao a figura plotada pelo grads nao mostrou a distribuição correta do vento zonal.">distribution</span></span>.<br>
<span id="result_box" class="long_text"><span title="Entao a figura plotada pelo grads nao mostrou a distribuição correta do vento zonal."></span><span style="background-color: rgb(255, 255, 255);" title="VOce teria alguma ideia de quais mudanças eu devo fazer no arquivo ctl."><br>
Does anyone have any idea what changes I should do in the file.ctl?</span></span><br><br>Thanks in advance<br>Henri<br><br>## original file.ctl<br><br><span id="result_box" class="long_text"><span title="Entao a figura plotada pelo grads nao mostrou a distribuição correta do vento zonal."></span></span>dset 19500117_1989.bin<br>
title file created by grads using lats4d <br>undef 1e+20 <br>options big_endian template <br>xdef 192 linear 0.000000 1.875000 <br>ydef 96 levels <br>
-88.572 -86.723 <br>-84.862 -82.999 -81.135 -79.271 -77.406 -75.541 -73.676 -71.811 -69.946 -68.081 <br>-66.216 -64.351 -62.486 -60.620 -58.755 -56.890 -55.025 -53.160 -51.294 -49.429 <br>-47.564 -45.699 -43.833 -41.968 -40.103 -38.238 -36.372 -34.507 -32.642 -30.777 <br>
-28.911 -27.046 -25.181 -23.316 -21.450 -19.585 -17.720 -15.855 -13.989 -12.124 <br>-10.259 -8.394 -6.528 -4.663 -2.798 -0.933 0.933 2.798 4.663 6.528 <br> 8.394 10.259 12.124 13.989 15.855 17.720 19.585 21.450 23.316 25.181 <br>
27.046 28.911 30.777 32.642 34.507 36.372 38.238 40.103 41.968 43.833 <br> 45.699 47.564 49.429 51.294 53.160 55.025 56.890 58.755 60.620 62.486 <br> 64.351 66.216 68.081 69.946 71.811 73.676 75.541 77.406 79.271 81.135 <br>
82.999 84.862 86.723 88.572 <br>zdef 1 linear 1 1<br>tdef 1459 linear 00Z01jan1989 6hr<br>vars 16<br>ghmt500 0 99 TIME MEAN GEOPOTENTIAL HEIGHT500hpa (M ) [] []<br>
ghmt200 0 99 TIME MEAN GEOPOTENTIAL HEIGHT200hpa (M ) [] []<br>spmt 0 99 TIME MEAN SEA LEVEL PRESSURE (Mb ) []<br>u850 0 99 TIME MEAN ZONAL WIND (U850hpa) (M/Sec ) []<br>u300 0 99 TIME MEAN ZONAL WIND (U300hpa) (M/Sec ) []<br>
u200 0 99 TIME MEAN ZONAL WIND (U200hpa) (M/Sec ) []<br>v850 0 99 TIME MEAN MERIDIONAL WIND (U850hpa) (M/Sec ) []<br>v300 0 99 TIME MEAN MERIDIONAL WIND (U300hpa) (M/Sec ) []<br>v200 0 99 TIME MEAN MERIDIONAL WIND (U200hpa) (M/Sec ) []<br>
fcmt200 0 99 TIME MEAN STREAM FUNCTION (M**2/Sec ) []<br>pvmt200 0 99 TIME MEAN VELOCITY POTENTIAL (M**2/Sec ) []<br>prec 0 99 TOTAL PRECIPITATION (Kg M**-2 Day**-1) []<br>rhmt850 0 99 TIME MEAN RELATIVE HUMIDITY850hpa (No Dim ) []<br>
rhmt700 0 99 TIME MEAN RELATIVE HUMIDITY700hpa (No Dim ) []<br>swos 0 99 SOIL WETNESS OF SURFACE (No Dim ) []<br>role 0 99 OUTGOING LONG WAVE AT TOP (W M**-2 ) []<br>endvars<br><br>## new file.ctl<br>
<br>dset u300_MAM1989.dat<br>title file created by grads using lats4d <br>undef 1e+20 <br>options big_endian template <br>xdef 192 linear 0.000000 1.875000 <br>ydef 96 levels <br>
-88.572 -86.723 <br>-84.862 -82.999 -81.135 -79.271 -77.406 -75.541 -73.676 -71.811 -69.946 -68.081 <br>-66.216 -64.351 -62.486 -60.620 -58.755 -56.890 -55.025 -53.160 -51.294 -49.429 <br>-47.564 -45.699 -43.833 -41.968 -40.103 -38.238 -36.372 -34.507 -32.642 -30.777 <br>
-28.911 -27.046 -25.181 -23.316 -21.450 -19.585 -17.720 -15.855 -13.989 -12.124 <br>-10.259 -8.394 -6.528 -4.663 -2.798 -0.933 0.933 2.798 4.663 6.528 <br> 8.394 10.259 12.124 13.989 15.855 17.720 19.585 21.450 23.316 25.181 <br>
27.046 28.911 30.777 32.642 34.507 36.372 38.238 40.103 41.968 43.833 <br> 45.699 47.564 49.429 51.294 53.160 55.025 56.890 58.755 60.620 62.486 <br> 64.351 66.216 68.081 69.946 71.811 73.676 75.541 77.406 79.271 81.135 <br>
82.999 84.862 86.723 88.572 <br>zdef 1 linear 1 1<br>tdef 367 linear 00Z1mar1989 6hr<br>vars 1<br>u300 0 99 TIME MEAN ZONAL WIND (U300hpa) (M/Sec ) []<br>endvars<br>
<br><br><br><br><br><div class="gmail_quote">2010/4/8 Eric Altshuler <span dir="ltr"><<a href="mailto:ela@cola.iges.org">ela@cola.iges.org</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear Henri,<br>
<br>
Your 'set fwrite' command is inside your while loop. So it gets executed every time through the loop. Move it outside the loop (just below 'set gxout fwrite'). This should fix your problem.<br>
<br>
Best regards,<br>
<br>
Eric L. Altshuler<br>
Assistant Research Scientist<br>
Center for Ocean-Land-Atmosphere Studies<br>
4041 Powder Mill Road, Suite 302<br>
Calverton, MD 20705-3106<br>
USA<br>
<br>
E-mail: <a href="mailto:ela@cola.iges.org">ela@cola.iges.org</a><br>
Phone: (301) 902-1257<br>
Fax: (301) 595-9793<br>
<div><div></div><div class="h5"><br>
----- Original Message -----<br>
From: "Henri Pinheiro" <<a href="mailto:henri.inpe@GMAIL.COM">henri.inpe@GMAIL.COM</a>><br>
To: <a href="mailto:GRADSUSR@LIST.CINECA.IT">GRADSUSR@LIST.CINECA.IT</a><br>
Sent: Thursday, April 8, 2010 4:19:13 PM<br>
Subject: How to use the fwrite function to get a specific time range and variable?<br>
<br>
Dear grads users,<br>
<br>
I have a binary data set and would want an output from a specific time range and variable.<br>
The input has 1459 time steps and 16 variables and I used a fwrite script to get a smaller period.<br>
<br>
The error message was<br>
SET FWrite Error: fwrite file is open<br>
Use DISABLE FWRITE command to close file<br>
<br>
Please, does anybody have any suggestion?<br>
the <a href="http://fwrite.gs" target="_blank">fwrite.gs</a> and file.ctl files are beneath<br>
<br>
Best Regards<br>
Henri<br>
<br>
## <a href="http://fwrite.gs" target="_blank">fwrite.gs</a><br>
<br>
'reinit'<br>
'open diaro.ctl'<br>
'set gxout fwrite'<br>
'set y 1 96'<br>
'set x 1 192'<br>
<br>
t=237<br>
while (t<=604)<br>
<br>
'set t 't<br>
<br>
'set fwrite u300_MAM1989.dat'<br>
'd u300'<br>
t=t+1<br>
endwhile<br>
<br>
'disable fwrite'<br>
'set gxout shaded'<br>
'set gxout contour'<br>
<br>
'quit'<br>
<br>
<br>
<br>
## file.ctl<br>
<br>
dset /rede/cycledi/diarioAGCM50/17/17/19500117_1989.bin<br>
title file created by grads using lats4d<br>
undef 1e+20<br>
options big_endian template<br>
xdef 192 linear 0.000000 1.875000<br>
ydef 96 levels<br>
-88.572 -86.723<br>
-84.862 -82.999 -81.135 -79.271 -77.406 -75.541 -73.676 -71.811 -69.946 -68.081<br>
-66.216 -64.351 -62.486 -60.620 -58.755 -56.890 -55.025 -53.160 -51.294 -49.429<br>
-47.564 -45.699 -43.833 -41.968 -40.103 -38.238 -36.372 -34.507 -32.642 -30.777<br>
-28.911 -27.046 -25.181 -23.316 -21.450 -19.585 -17.720 -15.855 -13.989 -12.124<br>
-10.259 -8.394 -6.528 -4.663 -2.798 -0.933 0.933 2.798 4.663 6.528<br>
8.394 10.259 12.124 13.989 15.855 17.720 19.585 21.450 23.316 25.181<br>
27.046 28.911 30.777 32.642 34.507 36.372 38.238 40.103 41.968 43.833<br>
45.699 47.564 49.429 51.294 53.160 55.025 56.890 58.755 60.620 62.486<br>
64.351 66.216 68.081 69.946 71.811 73.676 75.541 77.406 79.271 81.135<br>
82.999 84.862 86.723 88.572<br>
zdef 1 linear 1 1<br>
tdef 1459 linear 00Z01jan1989 6hr<br>
vars 16<br>
ghmt500 0 99 TIME MEAN GEOPOTENTIAL HEIGHT500hpa (M ) [] []<br>
ghmt200 0 99 TIME MEAN GEOPOTENTIAL HEIGHT200hpa (M ) [] []<br>
spmt 0 99 TIME MEAN SEA LEVEL PRESSURE (Mb ) []<br>
u850 0 99 TIME MEAN ZONAL WIND (U850hpa) (M/Sec ) []<br>
u300 0 99 TIME MEAN ZONAL WIND (U300hpa) (M/Sec ) []<br>
u200 0 99 TIME MEAN ZONAL WIND (U200hpa) (M/Sec ) []<br>
v850 0 99 TIME MEAN MERIDIONAL WIND (U850hpa) (M/Sec ) []<br>
v300 0 99 TIME MEAN MERIDIONAL WIND (U300hpa) (M/Sec ) []<br>
v200 0 99 TIME MEAN MERIDIONAL WIND (U200hpa) (M/Sec ) []<br>
fcmt200 0 99 TIME MEAN STREAM FUNCTION (M**2/Sec ) []<br>
pvmt200 0 99 TIME MEAN VELOCITY POTENTIAL (M**2/Sec ) []<br>
prec 0 99 TOTAL PRECIPITATION (Kg M**-2 Day**-1) []<br>
rhmt850 0 99 TIME MEAN RELATIVE HUMIDITY850hpa (No Dim ) []<br>
rhmt700 0 99 TIME MEAN RELATIVE HUMIDITY700hpa (No Dim ) []<br>
swos 0 99 SOIL WETNESS OF SURFACE (No Dim ) []<br>
role 0 99 OUTGOING LONG WAVE AT TOP (W M**-2 ) []<br>
endvars<br>
<br>
<br>
<br>
--<br>
Henri Rossi Pinheiro<br>
Meteorology Master Student<br>
National Institute for Space Research (INPE)<br>
Weather Forecast and Climate Studies Center (CPTEC)<br>
Cachoeira Paulista, SP/Brazil, 12630-000 Tel.:+55-12-3186-8607<br>
e-mails: <a href="mailto:henri.pinheiro@cptec.inpe.br">henri.pinheiro@cptec.inpe.br</a><br>
<a href="mailto:henri.inpe@gmail.com">henri.inpe@gmail.com</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Henri Rossi Pinheiro<br>Meteorology Master Student<br>National Institute for Space Research (INPE)<br>Weather Forecast and Climate Studies Center (CPTEC)<br>Cachoeira Paulista, SP/Brazil, 12630-000 Tel.:+55-12-3186-8607<br>
e-mails: <a href="mailto:henri.pinheiro@cptec.inpe.br">henri.pinheiro@cptec.inpe.br</a><br> <a href="mailto:henri.inpe@gmail.com">henri.inpe@gmail.com</a><br>