Closed marcguetg closed 6 years ago
Chirs: Then, the unitConversion specification could depend on the type. So, ‘position’ types should supply the factor to convert to ‘meter’. The ‘momentum’ type could provide the conversion to ‘eV/c’ or similar, and ‘time’ type could provide the factor to convert to ‘second’
Thats fine with me. However I would instead use a string with the base dimension. So Time would be 's', 'position' would be 's' and momentum would be 'kg·m·s−1'. I would keep the base with SI units and then use the conversion factor for more useful units.
There is already "unitDimension" for each "Record". Is this good enough?
With unitDimension I would describe the unit the value has, eg: eV
On this subject, here is a quick summary of what the openPMD approach is:
Each dataset (or "record") has the attributes unitDimension
and unitSI
. The attribute unitDimension
describes the dimension of the data (in terms of powers of length L, mass M, time T, etc.). The attribute unitSI
indicates the multiplicative factor that needs to be applied to the data in order to get it in the SI unit for that dimension.
For instance, for data that contains an energy in eV. This would be:
unitDimension = L^2 M^1 T^-2
(actually, it would be encoded as an array [2,1,-2,0,0,0,0])unitSI = 1.6021766208e-19
(conversion factor from eV to Joules)Would that cover your use case? Note that the original unit ("eV") is never mentioned in the openPMD format. (This is because some codes store their data in units that do not have an official name, e.g. units scaled to the background plasma density for some PIC codes.)
@RemiLehe: Thanks for the info. So one solution might be to have a "units" parameter which would be informational only but could be useful for someone looking at the file or to use with output.
@DavidSagan Yes, I think that this would be a good option.
Note that openPMD also has a dedicated attribute comment
for any purely informational remark that is supposed to be human-readable. However, I am not sure whether this is the right place for storing the unit name.
OK then a "units" parameter would be better than "comment" since a program displaying the contents of the file can know to display the units after the number.
Yes, that makes sense.
I have added unitsOfMeasurement to the draft standard.
Robert Ryne [12:03 PM] I looked at the github page. Where will the file state the meaning of the 6 coordinates?
new messages Christopher Mayes [1:28 PM] @Robert Ryne To that end, I suggest adding a ‘type’ string to each coordinate. The ‘type’ could be: ‘position’, ‘momemtum’, ‘time’.