<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="text-align:left; direction:ltr;">
<div>Hello Jeremy Miller,</div>
<div><br>
</div>
<div>I also use python to to generate input data for the MITgcm. I found that, to generate files that can be read by the MITgcm consistently, I needed to specify the type explicitly. </div>
<div>My way of saving the files would look like this in your case: </div>
<div><br>
</div>
<div>if sys.byteorder == 'little': tau_2.byteswap(True)</div>
<div>fid = open(''windx_siny.bin', 'wb')</div>
<div>tau_2.astype('float32').tofile(fid)</div>
<div><br>
</div>
<div>Of course, 'float32' could be replaced by 'float64' if you require double precision.</div>
<div><br>
</div>
<div>I hope this helps,</div>
<div>Jan Rieck</div>
<div> </div>
<div>On Thu, 2021-04-01 at 10:22 +0300, Jeremy Miller wrote:</div>
<blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
<div dir="ltr">Dear MITGCM forum,
<div><br>
</div>
<div>I am Jeremy Miller, I am new to MITgcm and I've been going through the tutorials. I have a question about the "Barotropic Ocean Gyre" tutorial (section 4.1).</div>
<div><br>
</div>
<div>I managed to compile and run the code, and re-produce the first two plots shown in section 4.1.5 for wind stress of τ = τ0 cos( πy/Ly), for both the advection and non-advection cases (with the provided input binary files). </div>
<div>I ran into problems when trying to produce the third plot, for the case where τ = τ0 sin( πy/Ly). I am a python user, so I translated gendata.m into python to write the input binary files 'windx_cosy.bin' 'windx_siny.bin' (see the file gendata_tut4.1py
attached). As explained in section 3.9 I've included the snippet </div>
<span class="gmail-im" style="color:rgb(80,0,80)">
<div><br>
</div>
<div>if sys.byteorder == 'little': tau_2.byteswap(True)</div>
<div><br>
</div>
</span>
<div>where "tau2" is the array to be output. There was no issue in the cosine wind stress, and I managed to reproduce the results that I got with the original 'windx_cosy.bin' provided in the tutorial. However, with the sine wind stress case, the output in
'Eta.0000077760.001.001' is all zeros. </div>
<div><br>
</div>
<div>When I attempt to read 'windx_siny.bin' with python into a new array called tau2_1. I get absurdly big numbers back, which do not match the original array tau2 that I created. If I Remove the snippet " if sys.byteorder == 'little': tau_2.byteswap(True)
", in the python gendata code, tau2_1 and tau2 match. But, then when I run the code again, the file output.txt contains a long list of NaNs.</div>
<span class="gmail-im" style="color:rgb(80,0,80)">
<div><br>
</div>
<div>I have also included the python code used to generate the plots in the file <a href="http://tut_4.1_plots.py/" target="_blank">tut_4.1_plots.py</a></div>
<div><br>
</div>
<div>Look forward to hearing from you.</div>
<div>Yours sincerely</div>
<div>Jeremy Miller</div>
</span></div>
<pre>_______________________________________________</pre>
<pre>MITgcm-support mailing list</pre>
<a href="mailto:MITgcm-support@mitgcm.org">
<pre>MITgcm-support@mitgcm.org</pre>
</a>
<pre><br></pre>
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support">
<pre>http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support</pre>
</a>
<pre><br></pre>
</blockquote>
</body>
</html>