Configuring units
This guide discusses how to reuse units which have been defined elsewhere within your data cube. If you're not sure which unit is right for your data set, take a look at the guide on choosing units.
Defining a new unit
csvcubed automatically defines new units using the unique values in your standard shape cube's units column. If desired, you can gain more control over how the units are defined by providing configuration in a qube-config.json file.
A data set like the one defined below can be paired with a JSON configuration allowing you to provide additional information about the units you are creating:
Location | Value | Measure | Unit |
---|---|---|---|
Biscuitburgh | 31 | Annual Income (Gross Value Added) | Pounds Sterling (£), Millions |
N.B. you must ensure that your units column definition contains defintions for all of the units contained within your dataset; the label
property must match the value found in the cell.
We can see in the above that we've defined a new unit called Pounds Sterling (£), Millions
and been able to configure its description; this will give extra context to help people really understand your data. But we can still improve our data by describing how this new unit relates to standardised units defined by other organisations so users can compare your data with other data cubes with confidence.
Linking a new unit to an existing unit
In the above example we defined a new unit called Pounds Sterling (£), Millions
. Looking at the guide on choosing units we see that we could relate this unit back to a well established standard unit defined by QUDT: PoundSterling.
Our dataset could of course be expressed directly in PoundSterling but that may make the data harder to read and compare so it would be ideal if you could define your own new unit Pounds Sterling (£), Millions
.
We've done some checking on the QUDT Units vocabulary to make sure that our new unit doesn't duplicating an existing unit so we decide that it is helpful to link Pounds Sterling (£), Millions
back to PoundSterling. This will ensure that software can automatically figure out how to compare our data with other data sets that use units related to PoundSterling.
In the following example, we'll show how to define new units for Pounds Sterling (£), Millions
and Barrels of petrol per day (,000)
with a standard shaped cube:
1. Ensure that your units column contains the new units' labels
Location | Value | Measure | Unit |
---|---|---|---|
Biscuitburgh | 31 | Annual Income (Gross Value Added) | Pounds Sterling (£), Millions |
Biscuitburgh | 2.6 | Average Daily Petrol Consumption | Barrels of petrol per day (,000) |
2. Edit your qube-config.json so that your units column has the following definition
N.B. you must ensure that your units column definition contains definitions for all of the units contained within your dataset.
Taking a closer look at the new Pounds Sterling (£), Millions
unit:
Taking a closer look at the new Barrels of petrol per day (,000)
unit:
Submitting to QUDT
Units may be submitted for consideration of inclusion in the QUDT Units vocabulary. This is an advanced step that may be useful for units which are extremely common.