Re: [GRASS-user] Median filtering time series in time only

2021-02-01 Thread Stefan Blumentrath
Hei,

Maybe a two-step approach with t.rast.aggregate and t.rast.mapcalc could work?
In t.rast.aggregate you define the granularity as e.g. 48 days if you want to 
get a running median over three time steps of a 16 days time series.

If you want to do it in one go (which would be understandable for heavy time 
series), I assume t.rast.algebra is your best bet. Here is an example on how to 
add a new function: https://github.com/OSGeo/grass/pull/905/files to the module 
(which admittedly is quit complex) (the d-falg helps with testing under 
development).
You may have to invent a distinct pattern for aggregate functions from 
r.mapcalc…

Cheers
Stefan


From: grass-user  On Behalf Of Veronica 
Andreo
Sent: torsdag 28. januar 2021 16:43
To: Nikos Alexandris 
Cc: grass-user @lists.osgeo.org 
Subject: Re: [GRASS-user] Median filtering time series in time only



El jue, 28 ene 2021 a las 0:05, 
mailto:n...@nikosalexandris.net>> escribió:

On 2021-01-27 16:59, Veronica Andreo wrote:

Both r.series and t.rast.series will estimate the median per pixel in time 
(either for the whole series or the time period you want). Would it be possible 
then with so e sort of special for cycle?

Sorry, I didn't pay attention. Reading more carefully.
Indeed, r.series (t.rast.series) do the median. But they will just create a 
single pixel for each pixel time series.
Then, as you write, it would take to hack-around a way to iterate over a given 
time series at the desired (number of) intervals, then compile a new time 
series.

What is the 'e sort' part?
Did you mean to type 'with some sort of...'?
And what does the 'cycle' refer to?

Sorry Nikos! I was writing from my phone and it gets messy sometimes. The 
intended sentence was: "Would it be possible then with some sort of special 
`for loop`?"


Thanks, Nikos

___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] v.rast.stats error: "Unable to seek"

2021-02-01 Thread Stefan Blumentrath
Hi Luis,

From the error message, it seems v.to.rast is failing, which may be due to a 
lack of resources - as Micha suggests.

Can you try
a) v.to.rast input=PSU output=test use=cat
if that does not work, we at least know it is not v.rast.stats and we might get 
a more specific error message... Not sure if the memory option in v.to.rast 
would have an effect here...

b) try to subdivide your data into chunks / tiles (polygons within tiles)?

Cheers
Stefan

-Original Message-
From: grass-user  On Behalf Of Micha Silver
Sent: mandag 1. februar 2021 21:32
To: Luí s Moreira de Sousa ; GRASS user list 

Subject: Re: [GRASS-user] v.rast.stats error: "Unable to seek"

Hi Luis:


On 2/1/21 5:30 PM, Luí s Moreira de Sousa wrote:
> Hi Micha, thank you for replying.
>
> I recreated the PSU layer in another mapset with the default SQLite 
> back-end, v.rast.stats fails with the exact same error. So this is not 
> related to the back-end.
>
> Below are the outputs you requested. Thank you.
>
> > v.info PSU
> ++
> | Name: PSU   |
> | Mapset: MAL   |
> | Location: S4AHomolosine 
> | |
> | Database: /home/duque004/Work/GRASSDATA 
> | |
> | Title: |
> | Map scale: 1:1   
> | | Name of creator:
> duque004  |
> | Organization: |
> | Source date: Fri Jan 29 08:13:08
> 2021  |
> | Timestamp (first layer): 
> none  |
> ||
> | Map format: native    
> | |
> ||
> |   Type of map: vector (level: 
> 2)   |
> | |
> |   Number of points:   0   Number of centroids:
> 19468516   |
> |   Number of lines:    0   Number of boundaries: 
> 38945853   |
> |   Number of areas:    19468516    Number of islands:
> 1  |
> | |
> |   Map is 3D: No   |
> |   Number of dblinks: 1    
> ||
> | |
> |   Projection: 
> unknown  |
> | |
> |   N:  4289569.27224353    S: 
> -4452930.72775647 |
> |   E:  6679312.25515029    W: 
> -2226387.74484971 |
> | |
> |   Digitization threshold: 
> 0    |
> | Comment: |
> | |
> ++
>
> > r.info MAL_Mode_5x5
> ++
> | Map:  MAL_Mode_5x5   Date: Thu Jan 28 09:08:14
> 2021    |
> | Mapset:   MAL    Login of Creator: 
> duque004    |
> | Location: S4AHomolosine |
> | DataBase: /home/duque004/Work/GRASSDATA |
> | Title:    5x5 neighborhood: mode of
> MAL_AFRICA |
> | Timestamp: none |
> ||
> | |
> |   Type of Map:  raster   Number of Categories: 
> 0   |
> |   Data Type: 
> CELL   |
> |   Rows: 87425  |
> |   Columns: 89057  
> ||
> |   Total Cells: 
> 7785808225 |
> |    Projection: 
> unknown |
> |    N: 4289569.27224353    S: -4452930.72775647 Res:
> 100    |
> |    E: 6679312.25515029    W: -2226387.74484971 Res:
> 100    |
> |   Range of data:    min = 0  max =
> 1   |
> | |
> |   Data Description: |
> |    generated by
> r.neighbors    |
> | |
> | Comments: |
> |    r.neighbors input="MAL_AFRICA" output="MAL_Mode_5x5" 
> method="mode" s\   |
> | ize=5 |
> | |
> ++
>

So the vector contains about 20 million polygons, and the raster about 8 
billion cells. (~=32GB ?)

Does you computer have enough muscle for this?



>
> --
> Luís
>
> Sent with ProtonMail 
> 

Re: [GRASS-user] v.rast.stats error: "Unable to seek"

2021-02-01 Thread Micha Silver

Hi Luis:


On 2/1/21 5:30 PM, Luí s Moreira de Sousa wrote:

Hi Micha, thank you for replying.

I recreated the PSU layer in another mapset with the default SQLite 
back-end, v.rast.stats fails with the exact same error. So this is not 
related to the back-end.


Below are the outputs you requested. Thank you.

> v.info PSU
++
| Name: PSU   |
| Mapset: MAL   |
| Location: S4AHomolosine |
| Database: /home/duque004/Work/GRASSDATA |
| Title: |
| Map scale: 1:1   |
| Name of creator: 
duque004  |

| Organization: |
| Source date: Fri Jan 29 08:13:08 
2021  |
| Timestamp (first layer): 
none  |

||
| Map format: native    |
||
|   Type of map: vector (level: 
2)   |

| |
|   Number of points:   0   Number of centroids:  
19468516   |
|   Number of lines:    0   Number of boundaries: 
38945853   |
|   Number of areas:    19468516    Number of islands:    
1  |

| |
|   Map is 3D: No   |
|   Number of dblinks: 1    |
| |
|   Projection: 
unknown  |

| |
|   N:  4289569.27224353    S: 
-4452930.72775647 |
|   E:  6679312.25515029    W: 
-2226387.74484971 |

| |
|   Digitization threshold: 
0    |

| Comment: |
| |
++

> r.info MAL_Mode_5x5
++
| Map:  MAL_Mode_5x5   Date: Thu Jan 28 09:08:14 
2021    |
| Mapset:   MAL    Login of Creator: 
duque004    |

| Location: S4AHomolosine |
| DataBase: /home/duque004/Work/GRASSDATA |
| Title:    5x5 neighborhood: mode of 
MAL_AFRICA |

| Timestamp: none |
||
| |
|   Type of Map:  raster   Number of Categories: 
0   |
|   Data Type: 
CELL   |

|   Rows: 87425  |
|   Columns: 89057  |
|   Total Cells: 
7785808225 |
|    Projection: 
unknown |
|    N: 4289569.27224353    S: -4452930.72775647 Res:   
100    |
|    E: 6679312.25515029    W: -2226387.74484971 Res:   
100    |
|   Range of data:    min = 0  max = 
1   |

| |
|   Data Description: |
|    generated by 
r.neighbors    |

| |
| Comments: |
|    r.neighbors input="MAL_AFRICA" output="MAL_Mode_5x5" 
method="mode" s\   |

| ize=5 |
| |
++



So the vector contains about 20 million polygons, and the raster about 8 
billion cells. (~=32GB ?)


Does you computer have enough muscle for this?





--
Luís

Sent with ProtonMail  Secure Email.

‐‐‐ Original Message ‐‐‐
On Friday, January 29, 2021 3:31 PM, Micha Silver  
wrote:





On Fri, Jan 29, 2021 at 3:53 PM Luí­s Moreira de Sousa via grass-user 
mailto:grass-user@lists.osgeo.org>> wrote:


Dear all,

I am getting the error "Unable to seek" with v.stats.error. There
is not much information that could point the cause, just a
warning saying that some data base files are not found. I checked
the database connection and everything looks in order (see
below). Any hints on what may be causing this error?

Thank you.

> v.rast.stats map=PSU raster=MAL_Mode_5x5 method=number
column_prefix=mal
ERROR: Unable to seek: Invalid argument
ERROR: An error occurred while converting vector to raster
WARNING: No data base element files found

> db.connect -p
driver: pg
database: s4a
schema: mal
group:

> psql -d s4a -p 5434
psql (12.5 (Ubuntu 12.5-0ubuntu0.20.04.1))
Type "help" for help.

s4a=# \dt mal.*
  List of relations
Schema |   Name   | 

Re: [GRASS-user] v.rast.stats error: "Unable to seek"

2021-02-01 Thread Veronica Andreo
Does the example in v.rast.stats manual [1] work for you, Luis? Is your
polygon vector map "healthy"? The error you get seems to be while
converting the vector to raster, hence I wonder if boundaries of all areas
in your vector are right.

my 0.02 cents
Vero

[1] https://grass.osgeo.org/grass78/manuals/v.rast.stats.html

El lun, 1 feb 2021 a las 16:31, Luí­s Moreira de Sousa via grass-user (<
grass-user@lists.osgeo.org>) escribió:

> Hi Micha, thank you for replying.
>
> I recreated the PSU layer in another mapset with the default SQLite
> back-end, v.rast.stats fails with the exact same error. So this is not
> related to the back-end.
>
> Below are the outputs you requested. Thank you.
>
> > v.info PSU
>
> ++
> | Name:
> PSU   |
> | Mapset:
> MAL   |
> | Location:
> S4AHomolosine |
> | Database:
> /home/duque004/Work/GRASSDATA |
> |
> Title: |
> | Map scale:
> 1:1   |
> | Name of creator:
> duque004  |
> |
> Organization:  |
> | Source date: Fri Jan 29 08:13:08
> 2021  |
> | Timestamp (first layer):
> none  |
>
> ||
> | Map format:
> native|
>
> ||
> |   Type of map: vector (level:
> 2)   |
> |
> |
> |   Number of points:   0   Number of centroids:
> 19468516   |
> |   Number of lines:0   Number of boundaries:
> 38945853   |
> |   Number of areas:19468516Number of islands:
> 1  |
> |
> |
> |   Map is 3D:
> No   |
> |   Number of dblinks:
> 1|
> |
> |
> |   Projection:
> unknown  |
> |
> |
> |   N:  4289569.27224353S:
> -4452930.72775647 |
> |   E:  6679312.25515029W:
> -2226387.74484971 |
> |
> |
> |   Digitization threshold:
> 0|
> |
> Comment: |
> |
> |
>
> ++
>
> > r.info MAL_Mode_5x5
>
> ++
> | Map:  MAL_Mode_5x5   Date: Thu Jan 28 09:08:14
> 2021|
> | Mapset:   MALLogin of Creator:
> duque004|
> | Location:
> S4AHomolosine|
> | DataBase:
> /home/duque004/Work/GRASSDATA|
> | Title:5x5 neighborhood: mode of
> MAL_AFRICA |
> | Timestamp:
> none|
>
> ||
> |
> |
> |   Type of Map:  raster   Number of Categories:
> 0   |
> |   Data Type:
> CELL   |
> |   Rows:
> 87425  |
> |   Columns:
> 89057  |
> |   Total Cells:
> 7785808225 |
> |Projection:
> unknown |
> |N: 4289569.27224353S: -4452930.72775647   Res:
> 100|
> |E: 6679312.25515029W: -2226387.74484971   Res:
> 100|
> |   Range of data:min = 0  max =
> 1   |
> |
> |
> |   Data
> Description:|
> |generated by
> r.neighbors|
> |
> |
> |
> Comments:|
> |r.neighbors input="MAL_AFRICA" output="MAL_Mode_5x5" method="mode"
> s\   |
> |
> ize=5   |
> |
> |
>
> ++
>
>
> --
> Luís
>
> Sent with ProtonMail  Secure Email.
>
> ‐‐‐ Original Message ‐‐‐
> On Friday, January 29, 2021 3:31 PM, Micha Silver 
> wrote:
>
>
>
> On Fri, Jan 29, 2021 

Re: [GRASS-user] v.rast.stats error: "Unable to seek"

2021-02-01 Thread Luí­s Moreira de Sousa via grass-user
Hi Micha, thank you for replying.

I recreated the PSU layer in another mapset with the default SQLite back-end, 
v.rast.stats fails with the exact same error. So this is not related to the 
back-end.

Below are the outputs you requested. Thank you.

> v.info PSU
++
| Name: PSU |
| Mapset: MAL |
| Location: S4AHomolosine |
| Database: /home/duque004/Work/GRASSDATA |
| Title: |
| Map scale: 1:1 |
| Name of creator: duque004 |
| Organization: |
| Source date: Fri Jan 29 08:13:08 2021 |
| Timestamp (first layer): none |
||
| Map format: native |
||
| Type of map: vector (level: 2) |
| |
| Number of points: 0 Number of centroids: 19468516 |
| Number of lines: 0 Number of boundaries: 38945853 |
| Number of areas: 19468516 Number of islands: 1 |
| |
| Map is 3D: No |
| Number of dblinks: 1 |
| |
| Projection: unknown |
| |
| N: 4289569.27224353 S: -4452930.72775647 |
| E: 6679312.25515029 W: -2226387.74484971 |
| |
| Digitization threshold: 0 |
| Comment: |
| |
++

> r.info MAL_Mode_5x5
++
| Map: MAL_Mode_5x5 Date: Thu Jan 28 09:08:14 2021 |
| Mapset: MAL Login of Creator: duque004 |
| Location: S4AHomolosine |
| DataBase: /home/duque004/Work/GRASSDATA |
| Title: 5x5 neighborhood: mode of MAL_AFRICA |
| Timestamp: none |
||
| |
| Type of Map: raster Number of Categories: 0 |
| Data Type: CELL |
| Rows: 87425 |
| Columns: 89057 |
| Total Cells: 7785808225 |
| Projection: unknown |
| N: 4289569.27224353 S: -4452930.72775647 Res: 100 |
| E: 6679312.25515029 W: -2226387.74484971 Res: 100 |
| Range of data: min = 0 max = 1 |
| |
| Data Description: |
| generated by r.neighbors |
| |
| Comments: |
| r.neighbors input="MAL_AFRICA" output="MAL_Mode_5x5" method="mode" s\ |
| ize=5 |
| |
++

--
Luís

Sent with [ProtonMail](https://protonmail.com) Secure Email.

‐‐‐ Original Message ‐‐‐
On Friday, January 29, 2021 3:31 PM, Micha Silver  wrote:

> On Fri, Jan 29, 2021 at 3:53 PM Luí­s Moreira de Sousa via grass-user 
>  wrote:
>
>> Dear all,
>>
>> I am getting the error "Unable to seek" with v.stats.error. There is not 
>> much information that could point the cause, just a warning saying that some 
>> data base files are not found. I checked the database connection and 
>> everything looks in order (see below). Any hints on what may be causing this 
>> error?
>>
>> Thank you.
>>
>>> v.rast.stats map=PSU raster=MAL_Mode_5x5 method=number column_prefix=mal
>> ERROR: Unable to seek: Invalid argument
>> ERROR: An error occurred while converting vector to raster
>> WARNING: No data base element files found
>>
>>> db.connect -p
>> driver: pg
>> database: s4a
>> schema: mal
>> group:
>>
>>> psql -d s4a -p 5434
>> psql (12.5 (Ubuntu 12.5-0ubuntu0.20.04.1))
>> Type "help" for help.
>>
>> s4a=# \dt mal.*
>> List of relations
>> Schema | Name | Type | Owner
>> +--+---+--
>> mal | psu | table | duque004
>> (1 rows)
>
> Could it be simply CAPS in the vector name vs small letters in the Postgres 
> table?
> Can you post the outputs from:
> v.info PSU
> r.info MAL_Mode_5x5
>
>> s4a=# select count(*) from mal.psu;
>> count
>> --
>> 19468516
>> (1 row)
>>
>> --
>> Luís
>>
>> ___
>> grass-user mailing list
>> grass-user@lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/grass-user
>
> --
> Micha Silver
> Ben Gurion Univ
> Sde-Boker Remote Sensing Lab
> cell: +972 (52) 3665918___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user