<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://climate-cms.wikis.unsw.edu.au/index.php?action=history&amp;feed=atom&amp;title=CodeBreak_08%2F12%2F2021</id>
	<title>CodeBreak 08/12/2021 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://climate-cms.wikis.unsw.edu.au/index.php?action=history&amp;feed=atom&amp;title=CodeBreak_08%2F12%2F2021"/>
	<link rel="alternate" type="text/html" href="http://climate-cms.wikis.unsw.edu.au/index.php?title=CodeBreak_08/12/2021&amp;action=history"/>
	<updated>2026-10-15T12:51:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>http://climate-cms.wikis.unsw.edu.au/index.php?title=CodeBreak_08/12/2021&amp;diff=3410&amp;oldid=prev</id>
		<title>C.carouge: Created page with &quot; = &lt;span style=&quot;font-size:13.999999999999998pt;  font-family:Arial;  color:#434343;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;...&quot;</title>
		<link rel="alternate" type="text/html" href="http://climate-cms.wikis.unsw.edu.au/index.php?title=CodeBreak_08/12/2021&amp;diff=3410&amp;oldid=prev"/>
		<updated>2021-12-15T01:00:38Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; = &amp;lt;span style=&amp;quot;font-size:13.999999999999998pt;  font-family:Arial;  color:#434343;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
= &amp;lt;span style=&amp;quot;font-size:13.999999999999998pt;  font-family:Arial;  color:#434343;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Trajectory Filtering&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;With a source dataset of trajectories identifying the numbered region a particle is in at each point of time, identify which particles are moving consistently from unique region to region and which are circling back and forth between a small number of regions.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;The most efficient way will be to use array operations, e.g. find transitions between regions with &amp;lt;tt&amp;gt;diff = region[1:] - region[:-1]&amp;lt;/tt&amp;gt;. Count of total regions entered will then be &amp;lt;tt&amp;gt;diff.where(diff&amp;amp;nbsp;!= 0).count()&amp;lt;/tt&amp;gt;. Explored in more detail &amp;lt;/span&amp;gt;[https://climate-cms.org/posts/2021-12-08-trajectories.html &amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#1155cc;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:underline;  -webkit-text-decoration-skip:none;  text-decoration-skip-ink:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;on the CMS blog&amp;lt;/span&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;font-size:13.999999999999998pt;  font-family:Arial;  color:#434343;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Fortran code strange behaviour&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Some inherited Fortran Code seemed to modify the content of an array depending on what index one starts to output of the array. We were not able to resolve this. The code is of questionable coding practices with a lot of implicit typing, questionable scoping, and complete lack of indentation. More in-depth analysis is needed that cannot be completed within the CodeBreak time.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;font-size:13.999999999999998pt;  font-family:Arial;  color:#434343;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Old Python code crash because of package not updated&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;An old Python code was unable to locate a required module, `global_land_mask` when run in the environment `conda/analysis3` and `conda/analysis3-unstable`. However it worked in `conda/analysis3-21.04`. It turns out that the library had been installed by the user as it is not a conda package and was located in `.local/lib/python3.8`. Since the Python version has been upgraded since analysis3-21.04, the user installed package needs to be reinstalled by the user.&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;font-size:13.999999999999998pt;  font-family:Arial;  color:#434343;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Using ERA5 data as input for HySplit&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;HySplit, a particle trajectory code, needs a very specific format for its input meteorological data. On Github, we found &amp;lt;/span&amp;gt;[https://github.com/sunt05/hysplit_metdata &amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#1155cc;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:underline;  -webkit-text-decoration-skip:none;  text-decoration-skip-ink:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;this repository&amp;lt;/span&amp;gt;]&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;with code to prepare ERA5 data in GRIB to the HySplit input format. The requestor wanted to use their own Windows computer but this didn’t work well. We’ll follow up with instructions to install and use on Gadi.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;font-size:13.999999999999998pt;  font-family:Arial;  color:#434343;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Cosima time slicing&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;When opening a dataset with Cosima cookbook, the dates specified aren't exact - the cookbook will return to the nearest file boundary, so if a file is containing a decade of data and you ask for 1994 to 1996, the cookbook will return a dataset covering 1990 to 2000 since that's what's in the file. You can then get the exact period you need with &amp;lt;tt&amp;gt;.sel(time=slice('1994','1996'))&amp;lt;/tt&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;font-size:13.999999999999998pt;  font-family:Arial;  color:#434343;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Understanding xarray, Dask and chunking&amp;amp;nbsp;&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Starting from an example script provided by Ram, we reviewed the basics of accessing big datasets. In particular:&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;ul style=&amp;quot;margin-top:0;margin-bottom:0;padding-inline-start:48px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;You can use &amp;lt;tt&amp;gt;ncdump -sh &amp;lt;filename&amp;gt;&amp;lt;/tt&amp;gt; to find out how the original files are chunked&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;The -h option shows the file header, adding -s shows the “hidden” attributes, like chunks, compression and more details on the file format&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;ul style=&amp;quot;margin-top:0;margin-bottom:0;padding-inline-start:48px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Trying to use chunks which are aligned to the way the files are chunked is important&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Consider how you will be accessing the data in the analysis, if you are averaging along the entire time axis and you have only 1 timestep per chunk (as it is often true for climate data) then you will need to load the entire variable for each grid point.&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Keeping chunks size around 200MB&amp;amp;nbsp;&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Use of a cluster to run in parallel with dask&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Use vectorise operations as much as you can. I.e. don’t use a loop to execute an operation on the entire variable.&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;Make use of lazy computation by dask. When running in parallel, Dask won’t compute what you write, it only computes the way to do it. So it’s ok to write operations that might be too big for the memory knowing it will only be computed one subset at a time.&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#000000;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;To see more on this &amp;lt;/span&amp;gt;[https://coecms-training.github.io/parallel/dask-intro.html &amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#1155cc;  background-color:transparent;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:underline;  -webkit-text-decoration-skip:none;  text-decoration-skip-ink:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;https://coecms-training.github.io/parallel/dask-intro.html&amp;lt;/span&amp;gt;] &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#3c4043;  background-color:#ffffff;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;We also discussed useful commands for jobs on the PBS scheduler: &amp;lt;tt&amp;gt;uqstat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;qcost&amp;lt;/tt&amp;gt;. Those are included in the nci_scripts module on hh5. See the information on &amp;lt;/span&amp;gt;[https://github.com/coecms/nci_scripts &amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#1155cc;  background-color:#ffffff;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:underline;  -webkit-text-decoration-skip:none;  text-decoration-skip-ink:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;the nci_scripts repository&amp;lt;/span&amp;gt;]&amp;lt;span style=&amp;quot;font-size:11pt;  font-family:Arial;  color:#3c4043;  background-color:#ffffff;  font-weight:400;  font-style:normal;  font-variant:normal;  text-decoration:none;  vertical-align:baseline;  white-space:pre;  white-space:pre-wrap&amp;quot;&amp;gt;.&amp;lt;/span&amp;gt;&lt;/div&gt;</summary>
		<author><name>C.carouge</name></author>
		
	</entry>
</feed>