Questions tagged [units-of-measurement]
Units of Measure are compile-time attributes that can be associated with numeric values, typically used to indicate length, volume, mass, and so on.
units-of-measurement
623
questions
2
votes
1
answer
77
views
issue with unit «knot» / «kn» with Dymola
I'm not sure but when switching to the last dymola version 2024x Refresh 1, I've lost the fact Dymola recognise the unit «kn» or «knot» (nautical mile per hour). The 2024x version used to recognise it....
0
votes
0
answers
38
views
flutter units of measurement
old question, what is unit of measurement in flutter? online chatter (eg SO 2018) says something like "logical pixels" or "density independent pixels". official docs also mention ...
0
votes
0
answers
27
views
Use ggplot2 and units package to define aesthetic mappings
I would like to create a plot where a variable (say z) defines a colour scheme for some points in a ggplot. For example:
library(ggplot2)
library(units)
#> udunits database from C:/Users/user/...
0
votes
1
answer
47
views
Correct way to add and subtract significant figures
There are actually two ways given to add or subtract significant figures in different books .In books like concepts of Physics by HC Verma it is written that round of the numbers given first and then ...
0
votes
0
answers
7
views
Are there any exceptions where errors are subracted
Can errors ever be subracted?
Any exceptional case where errors are subracted in measurement, like in relative error, percentage error,etc
Like whenever we calculate relative error in x/x+y we ...
1
vote
2
answers
92
views
Custom units in HKUnit for simple measurements like mass, length, and volume
HKQuantity and HKUnit support all of the common units of measurement, SI and otherwise, such as gram(), pound(), and stone().
The HealthKit classes also support custom complex units such as "foot-...
0
votes
2
answers
36
views
in python metpy.units not recognizing degC unit for temprature (calculatinh Heat Index)
i am calculating Heat Index (temprature, relative humidity) using python . showing error for units, thats why i am not able to calculate simple heat index
import pandas as pd
from metpy.calc import ...
0
votes
0
answers
21
views
Responsiveness seems different in VS Code and actual phone
*{
padding:0;
margin:0;
}
a{
text-decoration:none;
color:black;
}
ul{
list-style:none;
}
html{
color-scheme:light dark;
}
@media (prefers-color-scheme:dark){
#sidebar a{...
0
votes
0
answers
26
views
What does GB, MB, kB etc. mean in Microsoft Documentation?
Does anyone know if in official technical Microsoft documentation (e.g. https://learn.microsoft.com/en-us/azure/cosmos-db/concepts-limits) there is a consistent interpretation of data size units? That ...
0
votes
3
answers
58
views
How do I fix my unit converter in python? [duplicate]
Every time I try to convert it, it only shows the conversion from in. to mm.(aka the 1st expression)I would really appreciate it if you can help because I spent a long time.
a = input('Original Amount:...
0
votes
1
answer
42
views
TinyMCE - controlling font size of deployed text (font-size using EM)
I am using TinyMCE for content management in a website, that I develop. Meaning my client can input formatted text using TinyMCE editor and the website then outputs the html to appropriate place on ...
1
vote
1
answer
37
views
Getting wrong result using unitpy?
All three of the below print same properties, but why does last statement print 0 electronvolt?
import scipy
from unitpy import U, Q, Unit, Quantity
def print_properties(q):
print(q.unit)
...
3
votes
1
answer
161
views
Is there a less verbose way of expressing duration in ms and hours?
This C++ snippet prints a duration in ms and hours:
#include <iostream>
#include <chrono>
#include <thread>
using namespace std;
using namespace std::chrono;
int main() {
auto t0 ...
3
votes
1
answer
128
views
Formatting units and measurements. Why does Units init from symbol not produce same result as static init
Recently I came across a quite curious behavior regarding units and measurements in Swift which I can't understand. After creating measurements with units created with a static UnitMass accessor I can ...
0
votes
1
answer
48
views
DRF serializer validation of inputs across multiple nested fields
I'm using DRF serializers for models with measurements with units. Here's my model:
class Cargo(models.Model):
length = models.FloatField()
height = models.FloatField()
weight = models....
0
votes
0
answers
67
views
measuring with openlayers api does not give accurate value
my problem is that measured length or area with openlayers api has difference with the real one, for example a 55.30 meter length is 50.13 m in my web app. my data are in "projected UTM WGS84 ...
-3
votes
5
answers
243
views
Convert years.months formatted string to months in PHP
Unfortunately, I have data from a client in an unusual format. I expected years and months in separate columns, but instead, it comes as a dot-delimited string: [years].[months].
I have imported this ...
3
votes
0
answers
220
views
Using Swift's Measurement() type convert String into UnitType
I am internationalizing my app to accept and return measurements in any system. Because of this I won't be able to use a hard coded UnitType when creating a Measurement(value: value, unit: unit) (user ...
-2
votes
1
answer
143
views
How to tell user's locale units settings
I'm in the process of internationalizing my iOS app to handle both US customary units (imperial) and SI (metric). Is there a way to tell what the user's preferred settings are based on their locale or ...
0
votes
0
answers
82
views
How to configure editorconfig file to allow units of measurement after variable names?
I am configuring naming conventions for a C# project using Visual Studio and Resharper. I want to export the conventions to an .editorconfig file so that other developers have the same convention even ...
0
votes
2
answers
140
views
R print a units number with the respective unit
I have a script using number parameters with units. When printing messages to the log/user, I want the print to add the respective unit.
I expected R to be smart enough to do so when doing:
library(...
0
votes
1
answer
100
views
F# Bitwise operators and units of measure
When I define a unit of measure in my code, I can use the basic arithmetic operators on values with the unit without any problems, e.g.
type [<Measure>] m
let a = 1<m>
let b = 2<m>
(...
3
votes
0
answers
116
views
Unitful - Automatic conversion to preferred units under multiplication and division
I've just started using Unitful.jl to automatically perform dimensional analysis and unit conversion in my code. This does exactly what I want if I add or subtract variables - I work with atoms and ...
1
vote
0
answers
70
views
How I can convert the value of a unit into an other unit?
I have to convert a value from the old unit into the new unit.
The old unit can be mg/l and the new unit can be ug/ml. The oldValue is 8 mg/l. When I use the converter of google it shows me that the ...
-2
votes
1
answer
69
views
How to add two numbers having same units in python
I have a pandas dataframe where one column has values in kiloTon as abbreviated 'kt'. Now when I perform groupby on Country column and year column and call aggregation function sum on Value column, it'...
1
vote
1
answer
53
views
How to store Measurement in NSUbiquitousKeyValueStore?
I have a Measurement<UnitMass> object that I want to store in NSUbiquitousKeyValueStore. I use Measurement because I need to convert values between various locale on a regular basis.
I have ...
2
votes
2
answers
67
views
How to measure an monochrome area with unit squares made from a custom gridline?
I have an image with gridline like this and I want to measure each monochrome area with unit squares made from that gridline. The squares that mix with different colours shall not be counted. In the ...
0
votes
0
answers
116
views
problem using ggplot2::stat_summary with units in R
I receive an error when using stat_summary on values with defined units. The code works fine on unitless data. Any suggestions what I am doing wrong?
library(tidyverse)
library(units)
tb <- tibble(...
0
votes
3
answers
151
views
Where has the "units" sub-module in qiskit_nature gone?
I am trying to follow this qiskit "Electronic Structure" tutorial, but at the very first step, setting up the PySCF driver with the following
from qiskit_nature.units import DistanceUnit
...
1
vote
0
answers
84
views
Return pound-ounces instead of decimal pounds when using Measurement
Is it possible to have Measurement return 2lb 8oz instead of 2.5 lb when 2.5 is provided as the value as in the example below?
var pounds = Measurement(value:2.5, unit: UnitMass.pounds)// outputs 2.5 ...
2
votes
0
answers
157
views
How to show different mesurement units according to the user locale in flutter/dart
I have to display a Value in both imperial and metric systems for example 1000 Liter could be displayed as 1000 Gallons or 1000 Gl for shorl if the user is in the USA. or
500 ml vs 500 Oz
100 Miles ...
0
votes
0
answers
60
views
Why CSS sets a different computed style to width and margin when using mm units?
Changing a visible node's style width or marginLeft to 10px gives the same computed style: 10px.
However, on several navigators, it gives different results with 1mm.
Why ?
I ran this code:
const d = ...
1
vote
0
answers
158
views
Retreive the Quantity used to define a Unit in Java Unit of Measurement API (JSR 385)
I'm using JSR-385 with the RI (Indriya). I have a Quantity q1 and defined as such:
QuantityFormat qf = ServiceProvider.current().getFormatService().getQuantityFormat();
Quantity q1 = qf.parse("10 ...
1
vote
1
answer
330
views
Automatic reduction and cancellation of units with SymPy
I am having issues with getting units to cleanly simplify. The program I am writing is involved with the calculation of spring properties, requiring 10/11 user controlled variables and about a dozen ...
2
votes
2
answers
222
views
How can I parse the unit : "g/100mL" using unit-parse in Python?
I'm trying to parse strings in Python, looking for scientific values and units. I want to retrieve them in order to convert them to some other units.
I'm using the library unit-parse (based on pint) ...
1
vote
1
answer
83
views
R Reference Class: Field of type 'units'
I have a reference class, one of the fields for which is a 'units' object from the R units package. My initial class definition looked like this:
MyClass =
setRefClass(
"MyClass"...
0
votes
1
answer
184
views
How should I extract specific words in a string in a dataframe into a different column?
I have a dataset where one of the columns' rows are populated with strings with a few pieces of information, some of which I would like to extract into a different column.
Currently, I have something ...
0
votes
1
answer
102
views
std::cin and units library
I'm having a problem with a program I'm making when I try to ask the user to enter a value and then saving it to use it later in a formula.
This what I have done, the problem is that I can't use std::...
1
vote
1
answer
406
views
how to set a relative box size in toga python
I'm making an app with Beeware and toga using python and I need a box to be half size of its parent.
Does toga have relative size units like CSS? How do I use them?
I thought to use the parent box ...
1
vote
0
answers
296
views
Explain total memory reported by node on AKS
I'm trying to understand what the memory capacity means when running: kubectl describe node <mynode>
Snippet of the Result:
status:
capacity:
cpu: '16'
ephemeral-storage: 129886128Ki
...
0
votes
1
answer
90
views
Setting an alias name on a ProductUnit fails to return that alias during serialization
Task
I am trying to set an alias name on a UOM ProductUnitto allow the unit to be displayed in a human-friendly name in JSON/my frontend. The unit in question is "kg/h", so a mass-flow rate ...
0
votes
0
answers
111
views
Basic units in Python doesn't run graph
I'm trying to run this code(Below) that try to run 4 graphs in a single image help to run it please:
But I'm receiveing this error:
ModuleNotFoundError: No module named 'basic_units'
code:
from ...
1
vote
2
answers
147
views
How to calibrate length units for different display devices?
I need to be able to work with real length units for any display device and have to be able to rely on them. So I made myself a little ruler. On my laptop screen it comes out way too small. On my ...
0
votes
2
answers
27
views
What source of implicit spacing in a sequence of inline-block div (why does my "ruler" show too wide?)
I am trying to understand and test absolute length measurements by making a ruler that should show 1 cm wide major divs, with 1 mm wide minor divs with the half way mark being a little taller. But it'...
0
votes
1
answer
790
views
Is there a way to use a percent value in window.scrollTo()
I have a window.scrollTo() function on my website. It uses just a number value (or pixels) which works fine in a larger-sized window but does not scroll where I want on mobile devices. Instead, I want ...
0
votes
1
answer
71
views
MATLAB Can't assign VariableUnits to TimeTable
I'm trying to create a timetable for a motor simulation. I would like to keep track of the units of each variable.
Here is my code, a script in a file called CreateTT.m:
time.start = duration(0,0,0,0);...
0
votes
1
answer
926
views
How do I convert a Sympy expression to a floating point number?
I have been trying to swap from using Pint.py for units to using the Sympy units system.
I have examples of both code working in the image.
I need help please, converting the Sympy expresion to a ...
1
vote
1
answer
658
views
How are currency units used with Python Pint units?
I would like to do something like this:
import pint
ureg = pint.UnitRegistry()
kg = ureg.kg
USD = ureg.USD # not the way to do this
weight = 2.3 * kg
price = 1.49 * USD / kg
cost = weight * price
...
3
votes
2
answers
2k
views
How do I measure the center of the largest segmented region within an image?
I am following the code here, and after finishing step 3, I am given the segmented region of a particular slice image. My question is, how can I find the center of the large white region in the ...
1
vote
1
answer
91
views
Issue with generically casting a float with units to different units in F#
I am having a major issue handling units of measure in F#. I have handled them successfully so far, but I have only either been removing units to get back a float or casting a float to one with units. ...