-
Notifications
You must be signed in to change notification settings - Fork 36
/
udunits2.texi
293 lines (235 loc) · 10.1 KB
/
udunits2.texi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename udunits2.info
@include version.texi
@settitle UDUNITS @value{VERSION} Manual
@c %**end of header
@dircategory Science
@direntry
* udunits-2: (udunits2). The Unidata package for units of physical quantities.
@end direntry
@copying
@include COPYRIGHT
@end copying
@titlepage
@title The UDUNITS-2 Package
@author Steven R. Emmerson
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage
@contents
@ifnottex
@node Top, Introduction, (dir), (dir)
@top UDUNITS-2
This manual describes the UDUNITS-2 package, which contains
a C library for units of physical quantities and a unit-definition
and value-conversion utility.
@insertcopying
@end ifnottex
@menu
* Introduction:: Introduction
* Differences:: How this package differs from the UDUNITS-1 package
* Installation:: Installing this package
* Library:: The unit library
* Utility:: The unit utility
* Database:: The unit database
* Support:: Support for this package
* Complete Index:: Complete index
@end menu
@node Introduction, Differences, Top, Top
@chapter Introduction
@cindex Introduction
The UDUNITS-2 package provides support for units of physical quantities.
Its three main components are: 1) @ref{Top, , a C library, udunits2lib}
for units of physical quantities;
2) @ref{Top, , a utility, udunits2prog};
for obtaining the definition of a unit and for
converting numeric values between compatible units;
and 3) an @ref{Database, , extensive database of units}.
@node Differences, Installation, Introduction, Top
@chapter How This Package Differs from the Original @code{UDUNITS} Package
The @code{UDUNIT-2} package differs from the @code{UDUNITS-1}
package in the following ways:
@itemize @bullet
@item @strong{Support for non-ASCII characters:}
The @code{UDUNITS-1}
package only supports the ASCII character set. The @code{UDUNITS-2}
package supports the following character sets: ASCII, ISO 8859-1 (Latin-1),
and the UTF-8 encoding of ISO 10646 (Unicode). This means that unit
string specifications like "@code{µ°F·Ω⁻¹}" are now supported (your
viewer must support UTF-8 to display this string correctly).
@item @strong{Support for logarithmic units:} The unit string
specification "@code{0.1 lg(re 1 mW)}" specifies a deciBel unit with a
one milliwatt reference level.
Such units are fully integrated into the package and all meaningful
operations and conversions are supported.
@item @strong{Persistent value converters:}
It is now possible to obtain a @emph{converter} data-object, which can
be used to convert numeric values in one unit to numeric values in another,
compatible unit. The values can be @code{float}, @code{double}, or
one-dimensional arrays of @code{float}s or @code{double}s.
@item @strong{Improved API:} Due to the above changes, it was not
possible to keep the application programming interface (API) of the
@code{UDUNITS-1} package. The new interface, however, is easily
understood and easy to use. To support backward comptibility,
the package does contain a version 1 C API, which uses the version 2
library.
@item @strong{XML unit database:} The unit database is encoded using
human-readable XML rather than a custom format. The XML
parser included in the package supports an @emph{<import>} element to
allow easy and convenient customization.
@item @strong{No Fortran or Perl API:} Interfaces for these languages
have not yet been created. Contact
@email{support-udunits@@unidata.ucar.edu} if you are interested in
helping to create these interfaces.
@end itemize
One thing that has not changed is that almost all unit string specifications
understood by the @code{UDUNITS-1} package are also
understood by the @code{UDUNITS-2} package. One exception is
the symbol @code{g}, which in version 1 of the package was associated with
standard free fall (a unit of acceleration) but which is associated
with the unit gram in version 2 of the package.
@node Installation, Library, Differences, Top
@chapter Installing this Package
@cindex installation
@ignore
@menu
* Prerequisites:: Prerequisites for this package
* Obtain:: Obtaining this package
* Unix:: Installing on Unix-like environments
* Windows:: Installing on Windows environments
@end menu
@node Prerequisites, Obtain, , Installation
@section Prerequisites for This Package
@cindex prerequisites for this package
The Expat library and header-files must be installed. Look for the library
"libexpat" and the header-file "expat.h".
If this package is to be tested (which is optional), then the CUnit library
and header-files must be installed. Look for the library "libcunit" and the
header-files "CUnit/CUnit.h" and "CUnit/Basic.h".
If this package is to be built on a Windows system, then the CMake and MinGW
packages must be installed. Look for the utility "cmake" and the
directory/folder "MinGW".
@end ignore
@menu
* Prerequisites:: Prerequisites for this package
* Binary:: Installing from a binary distribution
* Source:: Installing from a source distribution
@end menu
@node Prerequisites, Binary, , Installation
@section Prerequisites for This Package
@cindex prerequisites for this package
The Expat library and header-files must be installed. Look for the library
"libexpat" and the header-file "expat.h".
If this package is to be tested (which is optional), then the CUnit library
and header-files must be installed. Look for the library "libcunit" and the
header-files "CUnit/CUnit.h" and "CUnit/Basic.h".
If this package is to be built on a Windows system, then the CMake and MinGW
packages must be installed. Look for the utility "cmake" and the
directory/folder "MinGW".
@node Binary, Source, Prerequisites, Installation
@section Installing from a Binary Distribution
@cindex installation, binary
Currently, only an RPM binary distribution is supported.
Download the distribution by browsing to the Unidata UDUNITS RPM repository at
@uref{https://artifacts.unidata.ucar.edu/service/rest/repository/browse/rpm-udunits/udunits/}
or by executing, for example, the following commands:
@example
cd ~/Downloads
wget https://artifacts.unidata.ucar.edu/repository/rpm-udunits/udunits/udunits-@value{VERSION}-x86_64.rpm
@end example
Install the distribution. For example,
@example
sudo rpm --install [--prefix=/opt/udunits] ~/Downloads/udunits-@value{VERSION}-x86_64.rpm
@end example
where the argument in square brackets is optional. The default installation
directory is @code{/usr/local}.
@node Source, , Binary, Installation
@section Installing from a Source Distribution
@cindex installation, source
@menu
* Unix:: Building and installing in Unix-like environments
* Windows:: Building and installing in Windows environments
@end menu
@node Unix, Windows, , Source
@subsection Installing from source on Unix
@cindex installing from source on Unix
Download the source by browsing to the Unidata UDUNITS source repository at
@uref{https://artifacts.unidata.ucar.edu/service/rest/repository/browse/downloads-udunits/}
or by executing, for example, the following commands:
@example
cd ~/Downloads
curl -O https://artifacts.unidata.ucar.edu/repository/downloads-udunits/udunits-@value{VERSION}.tar.gz
@end example
Unpack the distribution in an appropriate place. For example,
@example
cd /opt
sudo pax -rz < ~/Downloads/udunits-@value{VERSION}.tar.gz
@end example
Build and install the package. For example
@example
cd udunits2-@value{VERSION}
./configure [--prefix=@var{install_prefix}] >&configure.log
make all [check] install [install-html] [install-pdf]
@end example
where the arguments in square brackets are optional. The default installation
prefix is the parent directory of the source directory.
@node Windows, , Unix, Source
@subsection Installing from source on Windows
@cindex installing from source on Windows
Download the source by browsing to the Unidata UDUNITS source repository at
@uref{https://artifacts.unidata.ucar.edu/service/rest/repository/browse/downloads-udunits/}
or by executing, for example, the following commands:
@example
cd C:\Users\@var{current_user}\Downloads
curl -O https://artifacts.unidata.ucar.edu/repository/downloads-udunits/udunits-@value{VERSION}.zip
@end example
Unpack the distribution by opening the downloaded file and extracting the
contents to, for example, the user's "Downloads" folder. Note that, by default,
the extractor might create an extra top-level folder with a duplicate name.
Remove the extra folder from the destination path if this is the case -- either
before or after extraction.
Build and install the package using cmake(1). For example
@example
cd C:\Users\@var{current_user}\Downloads\udunits2-@value{VERSION}
mkdir build
cd build
cmake [-D CMAKE_INSTALL_PREFIX=@var{install_prefix}] ..
make all install
@end example
where the argument in square brackets is optional. The default installation
folder is the parent folder of the source folder.
@node Library, Utility, Installation, Top
@chapter Unit Library
@cindex Library, unit
@xref{UDUNITS Library, , , udunits2lib}, for details on this package's unit library.
@node Utility, Database, Library, Top
@chapter Unit Utility
@cindex Utility, unit
@xref{UDUNITS Utility, , , udunits2prog}, for details on this package's unit
utility.
@node Database, Support, Utility, Top
@chapter The Units Database
@cindex database
The database for the UDUNITS-2 package comprises one XML file containing
unit prefixes and four XML files containing unit definitions:
@itemize
@item @uref{../../udunits/udunits2-prefixes.xml,SI unit prefixes}
@item @uref{../../udunits/udunits2-base.xml,SI base units}
@item @uref{../../udunits/udunits2-derived.xml,SI derived units}
@item @uref{../../udunits/udunits2-accepted.xml,Units accepted for use with the SI}
@item @uref{../../udunits/udunits2-common.xml,Non-SI units}
@end itemize
@node Support, Complete Index, Database, Top
@chapter Support for this Package
@cindex support
@cindex package, support
The home-page for this package can be found at
@uref{http://www.unidata.ucar.edu/software/udunits/}.
Bug reports should be sent to
@email{support-udunits@@unidata.ucar.edu}.
@node Complete Index, , Support, Top
@unnumbered Index
@printindex cp
@bye