Coder Social home page Coder Social logo

Comments (6)

hellik avatar hellik commented on May 22, 2024

steps to reproduce in NC sample data set

  • g.region -a raster=elev_ned_30m@PERMANENT align=elev_ned_30m@PERMANENT

  • v.in.region output=myregion

  • quick digitize 1 polygon covering a small part of elev_ned_30m, e.g. mymask

  • r.mask vector=mymask@user1

  • r.mapcalc expression="test = elev_ned_30m@PERMANENT"

  • r.mask -r

  • v.rast.stats map=myregion@user1 raster=test@user1 column_prefix=zs

from grass.

hellik avatar hellik commented on May 22, 2024

easier, just use the example from the v.rast.stat manual, just choose only number and null_cells in method:

v.rast.stats map=myzipcodes_wake@user1 raster=elevation@PERMANENT column_prefix=elev method=number,null_cells

vraststatsscreenshot

v.db.select map=myzipcodes_wake@user1 columns=cat,OBJECTID,NAME,elev_number,elev_null_cells where=cat = 12 OR cat = 13
cat|OBJECTID|NAME|elev_number|elev_null_cells
12|17|RALEIGH|43980|43980
13|19|RALEIGH|135806|135806

elev_number and elev_null_cells shows the same figures

from grass.

hellik avatar hellik commented on May 22, 2024

maybe related:

v.rast.stats: addition of null_cells count - 26ae605

from grass.

hellik avatar hellik commented on May 22, 2024

easy testing by

g.region -p -a raster=elevation@PERMANENT align=elevation@PERMANENT             
projection: 99 (Lambert Conformal Conic)
zone:       0
datum:      nad83
ellipsoid:  a=6378137 es=0.006694380022900787
north:      228500
south:      215000
west:       630000
east:       645000
nsres:      10
ewres:      10
rows:       1350
cols:       1500
cells:      2025000
v.in.region output=myregion@user1

v.centerpoint input=myregion@user1 output=myregion_cp

v.buffer input=myregion_cp@user1 output=myregion_cp_buffer_250m distance=250

r.mask vector=myregion_cp_buffer_250m@user1

r.mapcalc expression="mytestraster = elevation@PERMANENT"

r.mask -r

v.db.addtable map=myregion@user1

v.rast.stats map=myregion@user1 raster=mytestraster@user1 column_prefix=elev method=number,null_cells
v.db.select map=myregion@user1                                                  
cat|elev_number|elev_null_cells
1|1944|1944 <=
r.univar -e map=mytestraster@user1                                              
total null and non-null cells: 2025000
total null cells: 2023056 <=
Of the non-null cells:
----------------------
n: 1944 <=
minimum: 108.462
maximum: 130.415
range: 21.9533
mean: 121.157
mean of absolute values: 121.157
standard deviation: 4.39815
variance: 19.3437
variation coefficient: 3.63013 %
sum: 235528.598342896
1st quartile: 118.196
median (even number of cells): 121.278
3rd quartile: 124.69
90th percentile: 126.597

total null cells: 2023056 by r.univar vs. 1944 by v.rast.stats

from grass.

hellik avatar hellik commented on May 22, 2024

manually r.univar test with the 2 rasters

r.univar map=mytestraster@user1 zones=myregion_raster@user1                     
zone 1 
total null and non-null cells: 2025000 <=
total null cells: 2023056  <=
Of the non-null cells:
----------------------
n: 1944
minimum: 108.462
maximum: 130.415
range: 21.9533
mean: 121.157
mean of absolute values: 121.157
standard deviation: 4.39815
variance: 19.3437
variation coefficient: 3.63013 %
sum: 235528.598342896

total null cells: 2023056 correctly counted in contrary to 1944 by v.rast.stats

from grass.

ninsbl avatar ninsbl commented on May 22, 2024

Backported in 94c2dc2 and 787f55e

from grass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.