<html><body><div style="color:#000; background-color:#fff; font-family:lucida console, sans-serif;font-size:10pt"><div id="yiv3571762485"><div><div style="color:#000;background-color:#fff;font-family:garamond, new york, times, serif;font-size:14pt;"><div id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_2889">Dear Sir/Ma'am,</div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_13"><br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_18"></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;" id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_15">I want to write the header of a netcdf file generated using sdfwrite as follows:</div><div id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_2904" style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;"><br
id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_25"></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_22" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_220" style="font-family:lucida console, sans-serif;"><span id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_219">netcdf monthly_SST {<br>dimensions:<br> time = 12 ;<br> z_t = 15 ;<br> nlon = 360 ;<br> nlat = 180 ;<br>variables:<br> double time(time) ;<br> time:long_name = "time" ;<br> time:units = "days since 0000-01-01 00:00:00" ;<br> time:bounds = "time_bound" ;<br> time:calendar = "noleap" ;<br> float z_t(z_t) ;<br>
z_t:long_name = "depth from surface to midpoint of layer" ;<br> z_t:units = "centimeters" ;<br> z_t:positive = "down" ;<br>
z_t:valid_min = 500.f ;<br> z_t:valid_max = 14500.f ;<br> float TEMP(time, z_t, nlat, nlon) ;<br> TEMP:_FillValue = 9.96921e+36f ;<br> TEMP:long_name = "Potential Temperature" ;<br> TEMP:units = "degC" ;<br> float TLAT(nlat) ;<br> TLAT:long_name = "array of t-grid latitudes" ;<br> TLAT:units = "degrees_north" ;<br> float TLONG(nlon) ;<br> TLONG:long_name = "array of t-grid longitudes" ;<br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_50"> TLONG:units = "degrees_east" </span></span></div><div id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_4415" style="color:rgb(0, 0,
0);font-size:18.6667px;
font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;"><br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_53"></div><div id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_4416" style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;">however, the auto-written header of the file generated by grads command is very different which has many missing information also. I tried to change the header using <br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_62"></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_59" style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;"><code id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_69">set sdfattr</code></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_63" style="color:rgb(0, 0,
0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;">but I have not got any success in changing anything. My grads script is as given below:</div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_72" style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;"><br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_76"></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_73" style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;"> <span id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_20392" style="font-family:lucida console, sans-serif;">'set yflip on'<br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_130"> 'set sdfwrite -flt
montly_temp.nc'</span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_127" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;
font-style:normal;"><span style="font-family:lucida console, sans-serif;"><br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_141"></span></div><div id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_13794" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_20389" style="font-family:lucida console, sans-serif;"> 'set sdfattr time String long_name time'</span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_131" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_20390" style="font-family:lucida console, sans-serif;"> 'set sdfattr time String units days since 0000-01-01 00:00:00'<br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_152"></span></div><div
id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_149" style="color:rgb(0, 0, 0);font-size:18.6667px;
background-color:transparent;font-style:normal;"><span id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_20391" style="font-family:lucida console, sans-serif;"> 'set sdfattr time String bounds time_bound'</span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_154" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span style="font-family:lucida console, sans-serif;"> 'set sdfattr time String calendar noleap'<br></span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_144" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span style="font-family:lucida console, sans-serif;"><br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_102"></span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_99" style="color:rgb(0, 0,
0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span style="font-family:lucida console, sans-serif;"> 'set sdfattr z_t String long_name depth from surface to midpoint of layer'<br> 'set sdfattr z_t String units centimeters'<br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_108"> 'set sdfattr z_t Sting positive down'</span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_105" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span style="font-family:lucida console, sans-serif;"> 'set sdfattr z_t float valid_min 500.f'</span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_124" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span style="font-family:lucida console,
sans-serif;"> 'set sdfattr z_t float valid_max 14500.f'</span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_109" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_20387" style="font-family:lucida console, sans-serif;"> <br> 'set sdfattr TEMP String long_name Potential Temperature'<br> 'set sdfattr TEMP String units degC'<br> 'set undef 'undef_value<br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_174"> </span></div><div id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_15995" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_20426" style="font-family:lucida console, sans-serif;">
'set sdfattr TLAT String long_name array of t-grid latitudes'</span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_182" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_20427" style="font-family:lucida console, sans-serif;"> 'set sdfattr TLAT String units degrees_north'</span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_187" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span style="font-family:lucida console, sans-serif;"><br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_192"></span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_189" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span style="font-family:lucida console, sans-serif;"> 'set sdfattr TLONG
String long_name array of t-grid longitudes'</span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_182" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;
font-style:normal;"><span style="font-family:lucida console, sans-serif;"><span id="yiv3571762485yui_3_13_0_ym1_1_1395627025493_20358"> 'set sdfattr TLONG String units degrees_east'</span></span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_189" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span style="font-family:lucida console, sans-serif;"> </span></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_167" style="color:rgb(0, 0, 0);font-size:18.6667px;background-color:transparent;font-style:normal;"><span id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_224" style="font-family:lucida console, sans-serif;"> 'q sdfwrite'<br> 'sdfwrite TEMP'<br> 'c sdfwrite'</span></div><div
id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_89" style="color:rgb(0, 0, 0);
font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;"><br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_93"></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_90" style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;">Since I am writing ocean data, I want to set top layer (500 cm) as first level but the bottom layer (14500 cm) is by default set as first level. I tried to invert levels using 'set yflip on' before sdfwrite command but it is not working. Please see how this can be achieved.</div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_198" style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;"><br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_203"></div><div
id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_200" style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;">Thank you.</div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_205" style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;">With Regards</div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_208" style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;">Pankaj Sinha <br id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_214"></div><div id="yiv3571762485yui_3_13_0_ym1_7_1395627025493_211" style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:garamond, new york, times, serif;background-color:transparent;font-style:normal;">Hokkaido University</div></div></div></div></div></body></html>