marcguetg / h5particle

1 stars 0 forks source link

Add types #3

Closed marcguetg closed 6 years ago

marcguetg commented 6 years ago

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’.

marcguetg commented 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’

marcguetg commented 6 years ago

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.

DavidSagan commented 6 years ago

There is already "unitDimension" for each "Record". Is this good enough?

marcguetg commented 6 years ago

With unitDimension I would describe the unit the value has, eg: eV

RemiLehe commented 6 years ago

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:

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.)

DavidSagan commented 6 years ago

@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.

RemiLehe commented 6 years ago

@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.

DavidSagan commented 6 years ago

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.

RemiLehe commented 6 years ago

Yes, that makes sense.

DavidSagan commented 6 years ago

I have added unitsOfMeasurement to the draft standard.