4

I have a shapefile of a grid cell. I would like to select all the observations (cells) whose values in column "mean" is not an entire number. I was thinking to do it selecting all the observations which contains a point "." but I am still not able to do it. I am open to other ways to do it.

The main objective of this is to see all the selected observations in the map (together with observations no selected) to correct them manually. I need to see them in the map with the rest of the observations in order to know how I should correct them.

I attach a screenshot of my Attribute Table, whose column _mean is the one I am interested in. As you can see, some values are entire but others are decimals. I would like to select all the decimals observations (of variable _mean) and to see in the map all the selected observations together with the no selected ones.

enter image description here

[Edit: I attach a screenshot of the data type of field _mean]

enter image description here

3
  • I have updated the information in the question
    – OgeiD
    Apr 11, 2022 at 9:42
  • 1
    Remember also that some of those with no decimals could be that way because they are exactly equal to a whole number, even though the calculation is precise. Apr 11, 2022 at 11:01
  • @LeighBettenay pfff, that is a very good point... In fact, I have some entire numbers that are wrong... let's see how I localize them...
    – OgeiD
    Apr 11, 2022 at 14:08

2 Answers 2

5

One can use this "Select by expression" tool together with this function regexp_match():

regexp_match("mean",'^[0-9]+$') != 1

result

Note: This expression will work for both: field of a Real type ("mean") and field of a String type ("mean2").

For selecting just a dot . in the field one can use the following expression:

regexp_match("mean2",'\\.') > 0 # otherwise regexp_match("mean2",'\\.') = 0

References:

0
4

Another solution is to use the modulo operator % that return the remainder of division.

By using this expression :

"_mean" % 1 != 0

you will select all value with decimal part (ie value where the remainder of dividing the value of the "_mean" field by 1 is not equal to 0)

Of course it will only work with numerical value.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.