{"id":4519,"date":"2020-03-11T12:42:24","date_gmt":"2020-03-11T12:42:24","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/csf3\/?page_id=4519"},"modified":"2020-03-11T12:42:24","modified_gmt":"2020-03-11T12:42:24","slug":"udunits","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/software\/libraries\/udunits\/","title":{"rendered":"UDUNITS"},"content":{"rendered":"<h2>Overview<\/h2>\n<p><a href=\"https:\/\/www.unidata.ucar.edu\/software\/udunits\/\">UDUNITS<\/a> is a C library providing arithmetic manipulation of units and conversion of numeric values between compatible units. The package contains an extensive unit database, which is in XML format and user-extendable. The package also contains a command-line utility for investigating units and converting values.<\/p>\n<h2>Restrictions on use<\/h2>\n<p>There are no restrictions on access to the UDUNTIS libraries on CSF. The software is released under a <a href=\"https:\/\/www.unidata.ucar.edu\/software\/udunits\/udunits-current\/doc\/udunits\/udunits2.html\">license<\/a> given at the start of the online documentation and at <code>$UDUNITSDIR\/COPYRIGHT<\/code> text file on the CSF. All usage must adhere to this license.<\/p>\n<h2>Set up procedure<\/h2>\n<p>We now recommend loading modulefiles within your jobscript so that you have a full record of how the job was run. See the example jobscript below for how to do this. Alternatively, you may load modulefiles on the login node and let the job <abbr title=\"add '#$ -V' to your jobscript\">inherit these settings<\/abbr>.<\/p>\n<p>Load <strong>one<\/strong> of the following modulefiles to set up your environment:<\/p>\n<pre>\r\nmodule load libs\/gcc\/udunits\/2.2.26\r\n<\/pre>\n<h2>Compiling an UDUNITS-capable application<\/h2>\n<p>You will mostly use the UDUNITS installation on CSF3 when compiling your own software. This allows you to add UDUNITS functionality to your own apps. There are some tools you can also run to process existing data files (see below).<\/p>\n<p>The modulefiles will set an environment variable named <code>${UDUNITSDIR}<\/code> which can then be used in your compilation process (e.g., in a Makefile or directly on the command-line) to access the header and library files:<\/p>\n<ul>\n<li>To inform the compiler of the header file directory use:\n<pre>gcc -I${UDUNITSDIR}\/include ....<\/pre>\n<\/li>\n<li>To inform the compiler of the library files use:\n<pre>gcc ... -L${UDUNITSDIR}\/lib -ludunits2<\/pre>\n<\/li>\n<li>In a Makefile ensure you use <code>${UDUNITSDIR}<\/code> rather than <code>$UDUNITSDIR<\/code>.<\/li>\n<\/ul>\n<p>An example compilation command could be<\/p>\n<pre>\r\ngcc -I${UDUNITSDIR}\/include example_units.c -o example_units -L${UDUNITSDIR}\/lib -ludunits2\r\n<\/pre>\n<h2>Running an UDUNITS-capable application<\/h2>\n<p>You must load the UDUNITS modulefile before running your UDUNITS-capable application (unless you have statically linked your code against the UDUNITS libraries). <\/p>\n<p>Please do not run UDUNITS-capable applications on the login node. Jobs should be submitted to the compute nodes via batch.<\/p>\n<h3>Serial batch job submission<\/h3>\n<p>Create a batch submission script (which will load the modulefile in the jobscript), for example:<\/p>\n<pre>\r\n#!\/bin\/bash --login\r\n#$ -cwd             # Job will run from the current directory\r\n                    # NO -V line - we load modulefiles in the jobscript\r\n\r\n# Load the serial (non-MPI) modulefile\r\nmodule load libs\/gcc\/udunits\/2.2.26\r\n\r\n# Run my application I compiled earlier\r\n.\/<em>myunitsapp<\/em> <em>arg1<\/em> ...\r\n<\/pre>\n<p>Submit the jobscript using: <\/p>\n<pre>qsub <em>scriptname<\/em><\/pre>\n<p>where <em>scriptname<\/em> is the name of your jobscript.<\/p>\n<h3>UDUNITS Tools<\/h3>\n<p>The UDUNITS <code>bin<\/code> directory is added to your path so that you can access the <code>udunits2<\/code> tool. Use <code>ls ${UDUNITSBIN}<\/code> to see all binary tools:<\/p>\n<pre>\r\n# UDUNITS tools - must be used in batch jobs, as above\r\nudunits2\r\n<\/pre>\n<h2>Further info<\/h2>\n<p>See the UDUNITS website for <a href=\"\">full documentation<\/a>.<\/p>\n<h2>Updates<\/h2>\n<p>None.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview UDUNITS is a C library providing arithmetic manipulation of units and conversion of numeric values between compatible units. The package contains an extensive unit database, which is in XML format and user-extendable. The package also contains a command-line utility for investigating units and converting values. Restrictions on use There are no restrictions on access to the UDUNTIS libraries on CSF. The software is released under a license given at the start of the online.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/software\/libraries\/udunits\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":140,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-4519","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/4519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/comments?post=4519"}],"version-history":[{"count":1,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/4519\/revisions"}],"predecessor-version":[{"id":4520,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/4519\/revisions\/4520"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/140"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/media?parent=4519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}