[GRASS-user] Unable to perform resampling

Hello everyone,

I am interested in performing resampling of a fine resolution DEM Model (which is imported as a GTiff file in grass GIS). I tried the following 2 approaches and neither of them was successful. Can you help me figure out where I went wrong? Thanks in Advance.

Details about originally imported DEM model:
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 29N
south: 28:06N
west: 72E
east: 77:24E
nsres: 0:00:01.08
ewres: 0:00:01.08
rows: 3000
cols: 18000
cells: 54000000

MY AIM: To convert a fine grid DEM (30 m resolution) to coarse grid DEM (8km)

APPROACH 1: Using r.resample.rst

g.region raster=test5_r1
r.resamp.rst input=test5_r1 ew_res=8000 ns_res=8000

In this second command’s execution, I get error (log attached below):
Processing all selected output files will require 4 bytes of disk space for temp files.
Temporarily changing the region to desired resolution …
Changing back to the original region …
Percent complete:
ERROR: Unable to seek: Invalid argument

APPROACH 2: Using r.resample.stats
g.region raster=test5_r1
g.region nsres=8000 ewres=8000 // problematic part
r.resamp.stats -w input=test5_r1 output=test5_r1_8km
In this second command’s execution the entire map seems to get clubbed into a single large pixel. I have attached results of g.region -ap below:
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 29N
south: 28:06N
west: 72E
east: 77:24E
nsres: 0:54
ewres: 5:24
rows: 1
cols: 1
cells: 1

Also, can you tell me which method will be more suitable for my final goal?

Thanks & Regards,
Bharath


Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

Hello Bharath,

I think your problem is that you are working in a latlong location and trying to set a resolution of 8000 degrees, which is not possible. If your desired final resolution is ~8 km, you will need to set the region resolution to its equivalent in degrees (the unit of latlong CRS). Otherwise, work with projected CRS like UTM for example (recommended).

Furthermore, if you want to go from high res to lower res (upscaling), r.resamp.stats is your friend, so the second approach would be fine. The problem lays in the resolution you are setting.

HTH,

Vero

El lun, 23 nov 2020 a las 22:20, BHARATH RAM (<br11@iitbbs.ac.in>) escribió:

Hello everyone,

I am interested in performing resampling of a fine resolution DEM Model (which is imported as a GTiff file in grass GIS). I tried the following 2 approaches and neither of them was successful. Can you help me figure out where I went wrong? Thanks in Advance.

Details about originally imported DEM model:
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 29N
south: 28:06N
west: 72E
east: 77:24E
nsres: 0:00:01.08
ewres: 0:00:01.08
rows: 3000
cols: 18000
cells: 54000000

MY AIM: To convert a fine grid DEM (30 m resolution) to coarse grid DEM (8km)

APPROACH 1: Using r.resample.rst

g.region raster=test5_r1
r.resamp.rst input=test5_r1 ew_res=8000 ns_res=8000

In this second command’s execution, I get error (log attached below):
Processing all selected output files will require 4 bytes of disk space for temp files.
Temporarily changing the region to desired resolution …
Changing back to the original region …
Percent complete:
ERROR: Unable to seek: Invalid argument

APPROACH 2: Using r.resample.stats
g.region raster=test5_r1
g.region nsres=8000 ewres=8000 // problematic part
r.resamp.stats -w input=test5_r1 output=test5_r1_8km
In this second command’s execution the entire map seems to get clubbed into a single large pixel. I have attached results of g.region -ap below:
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 29N
south: 28:06N
west: 72E
east: 77:24E
nsres: 0:54
ewres: 5:24
rows: 1
cols: 1
cells: 1

Also, can you tell me which method will be more suitable for my final goal?

Thanks & Regards,
Bharath


Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited._______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

[cc-ing the list]

The examples in the manuals are in meters because they are based on the North Carolina sample dataset which CRS is Lambert Conformal Conic. The units of this CRS are meters.

g.proj -p
-PROJ_INFO-------------------------------------------------
name : Lambert Conformal Conic
proj : lcc
datum : nad83
a : 6378137.0
es : 0.006694380022900787
lat_1 : 36.16666666666666
lat_2 : 34.33333333333334
lat_0 : 33.75
lon_0 : -79
x_0 : 609601.22
y_0 : 0
no_defs : defined
-PROJ_UNITS------------------------------------------------
unit : Meter
units : Meters
meters : 1

You have to adjust to the units of the CRS that you use when it comes to resolution. There’s no way to set resolution in meters if you work in latlong. Hence the recommendation to work in projected systems.

Some modules might use distance in meters for certain parameters even when working in latlong, because they convert such distances within the source code into radians (if I’m not mistaken). If not, they will raise a warning. Again, to avoid such issues, it’s a good practice to work with projected CRS.

best,

Vero

El lun, 23 nov 2020 a las 22:46, BHARATH RAM (<br11@iitbbs.ac.in>) escribió:

Dear Ms.Veronica Andreo,
Thank you very much for your quick reply. Yes your suggestion works correctly.

But I find it a litttle suprising since in the documentation (for modukes like r.resample.stats, r.sun etc…) & in several examples meter seems to be the default units used for distance and I assumed that for my case as well it was the same (even though g.region -p prints out in decimal degree).

Is there any way to change the units back to meter as default?

Thank you
Regards,

Bharath

On Tue, Nov 24, 2020, 3:03 AM Veronica Andreo <veroandreo@gmail.com> wrote:

Hello Bharath,

I think your problem is that you are working in a latlong location and trying to set a resolution of 8000 degrees, which is not possible. If your desired final resolution is ~8 km, you will need to set the region resolution to its equivalent in degrees (the unit of latlong CRS). Otherwise, work with projected CRS like UTM for example (recommended).

Furthermore, if you want to go from high res to lower res (upscaling), r.resamp.stats is your friend, so the second approach would be fine. The problem lays in the resolution you are setting.

HTH,

Vero

El lun, 23 nov 2020 a las 22:20, BHARATH RAM (<br11@iitbbs.ac.in>) escribió:

Hello everyone,

I am interested in performing resampling of a fine resolution DEM Model (which is imported as a GTiff file in grass GIS). I tried the following 2 approaches and neither of them was successful. Can you help me figure out where I went wrong? Thanks in Advance.

Details about originally imported DEM model:
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 29N
south: 28:06N
west: 72E
east: 77:24E
nsres: 0:00:01.08
ewres: 0:00:01.08
rows: 3000
cols: 18000
cells: 54000000

MY AIM: To convert a fine grid DEM (30 m resolution) to coarse grid DEM (8km)

APPROACH 1: Using r.resample.rst

g.region raster=test5_r1
r.resamp.rst input=test5_r1 ew_res=8000 ns_res=8000

In this second command’s execution, I get error (log attached below):
Processing all selected output files will require 4 bytes of disk space for temp files.
Temporarily changing the region to desired resolution …
Changing back to the original region …
Percent complete:
ERROR: Unable to seek: Invalid argument

APPROACH 2: Using r.resample.stats
g.region raster=test5_r1
g.region nsres=8000 ewres=8000 // problematic part
r.resamp.stats -w input=test5_r1 output=test5_r1_8km
In this second command’s execution the entire map seems to get clubbed into a single large pixel. I have attached results of g.region -ap below:
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 29N
south: 28:06N
west: 72E
east: 77:24E
nsres: 0:54
ewres: 5:24
rows: 1
cols: 1
cells: 1

Also, can you tell me which method will be more suitable for my final goal?

Thanks & Regards,
Bharath


Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited._______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

Okay, thanks for the clarification.
(Also, I will remember to cc the list in future).

I have one more question if it’s okay to ask(not related to above issue). I understand Grass GIS queries & issues are resolved through mailing lists at the moment and the archives. Not meaning to be disrespectful of the community, but won’t it be much useful when we have a forum like website to post & answer each others queries (it can especially be useful since newcomers like me don’t have to flood the mailing list with common issues)?

Thank you.

Regards,
Bharath Ram.

On Tue, Nov 24, 2020, 3:30 AM Veronica Andreo <veroandreo@gmail.com> wrote:

[cc-ing the list]

The examples in the manuals are in meters because they are based on the North Carolina sample dataset which CRS is Lambert Conformal Conic. The units of this CRS are meters.

g.proj -p
-PROJ_INFO-------------------------------------------------
name : Lambert Conformal Conic
proj : lcc
datum : nad83
a : 6378137.0
es : 0.006694380022900787
lat_1 : 36.16666666666666
lat_2 : 34.33333333333334
lat_0 : 33.75
lon_0 : -79
x_0 : 609601.22
y_0 : 0
no_defs : defined
-PROJ_UNITS------------------------------------------------
unit : Meter
units : Meters
meters : 1

You have to adjust to the units of the CRS that you use when it comes to resolution. There’s no way to set resolution in meters if you work in latlong. Hence the recommendation to work in projected systems.

Some modules might use distance in meters for certain parameters even when working in latlong, because they convert such distances within the source code into radians (if I’m not mistaken). If not, they will raise a warning. Again, to avoid such issues, it’s a good practice to work with projected CRS.

best,

Vero

El lun, 23 nov 2020 a las 22:46, BHARATH RAM (<br11@iitbbs.ac.in>) escribió:

Dear Ms.Veronica Andreo,
Thank you very much for your quick reply. Yes your suggestion works correctly.

But I find it a litttle suprising since in the documentation (for modukes like r.resample.stats, r.sun etc…) & in several examples meter seems to be the default units used for distance and I assumed that for my case as well it was the same (even though g.region -p prints out in decimal degree).

Is there any way to change the units back to meter as default?

Thank you
Regards,

Bharath

On Tue, Nov 24, 2020, 3:03 AM Veronica Andreo <veroandreo@gmail.com> wrote:

Hello Bharath,

I think your problem is that you are working in a latlong location and trying to set a resolution of 8000 degrees, which is not possible. If your desired final resolution is ~8 km, you will need to set the region resolution to its equivalent in degrees (the unit of latlong CRS). Otherwise, work with projected CRS like UTM for example (recommended).

Furthermore, if you want to go from high res to lower res (upscaling), r.resamp.stats is your friend, so the second approach would be fine. The problem lays in the resolution you are setting.

HTH,

Vero

El lun, 23 nov 2020 a las 22:20, BHARATH RAM (<br11@iitbbs.ac.in>) escribió:

Hello everyone,

I am interested in performing resampling of a fine resolution DEM Model (which is imported as a GTiff file in grass GIS). I tried the following 2 approaches and neither of them was successful. Can you help me figure out where I went wrong? Thanks in Advance.

Details about originally imported DEM model:
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 29N
south: 28:06N
west: 72E
east: 77:24E
nsres: 0:00:01.08
ewres: 0:00:01.08
rows: 3000
cols: 18000
cells: 54000000

MY AIM: To convert a fine grid DEM (30 m resolution) to coarse grid DEM (8km)

APPROACH 1: Using r.resample.rst

g.region raster=test5_r1
r.resamp.rst input=test5_r1 ew_res=8000 ns_res=8000

In this second command’s execution, I get error (log attached below):
Processing all selected output files will require 4 bytes of disk space for temp files.
Temporarily changing the region to desired resolution …
Changing back to the original region …
Percent complete:
ERROR: Unable to seek: Invalid argument

APPROACH 2: Using r.resample.stats
g.region raster=test5_r1
g.region nsres=8000 ewres=8000 // problematic part
r.resamp.stats -w input=test5_r1 output=test5_r1_8km
In this second command’s execution the entire map seems to get clubbed into a single large pixel. I have attached results of g.region -ap below:
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 29N
south: 28:06N
west: 72E
east: 77:24E
nsres: 0:54
ewres: 5:24
rows: 1
cols: 1
cells: 1

Also, can you tell me which method will be more suitable for my final goal?

Thanks & Regards,
Bharath


Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited._______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.


Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

Well, yes, there’s the mailing list, posts with questions in https://gis.stackexchange.com, twitter account and facebook community, and the issues in the GitHub repo for reporting bugs or proposing new features. Moreover, you can check https://grass.osgeo.org/learn/ for plenty of other resources (tutorials, courses, books, etc.) and the wiki (https://grasswiki.osgeo.org/wiki/GRASS-Wiki).

I believe mailing lists work better for most of us. Also, that’s where you can reach a larger audience. Having to check yet another platform to see if there are questions that are mostly already answered in the mailing list archives, tutorials or the wiki seems like a bit too much to me. However, if someone else is willing to manage such a forum, they are most welcome :slight_smile:

best,

Vero

El lun, 23 nov 2020 a las 23:22, BHARATH RAM (<br11@iitbbs.ac.in>) escribió:

Okay, thanks for the clarification.
(Also, I will remember to cc the list in future).

I have one more question if it’s okay to ask(not related to above issue). I understand Grass GIS queries & issues are resolved through mailing lists at the moment and the archives. Not meaning to be disrespectful of the community, but won’t it be much useful when we have a forum like website to post & answer each others queries (it can especially be useful since newcomers like me don’t have to flood the mailing list with common issues)?

Thank you.

Regards,
Bharath Ram.

On Tue, Nov 24, 2020, 3:30 AM Veronica Andreo <veroandreo@gmail.com> wrote:

[cc-ing the list]

The examples in the manuals are in meters because they are based on the North Carolina sample dataset which CRS is Lambert Conformal Conic. The units of this CRS are meters.

g.proj -p
-PROJ_INFO-------------------------------------------------
name : Lambert Conformal Conic
proj : lcc
datum : nad83
a : 6378137.0
es : 0.006694380022900787
lat_1 : 36.16666666666666
lat_2 : 34.33333333333334
lat_0 : 33.75
lon_0 : -79
x_0 : 609601.22
y_0 : 0
no_defs : defined
-PROJ_UNITS------------------------------------------------
unit : Meter
units : Meters
meters : 1

You have to adjust to the units of the CRS that you use when it comes to resolution. There’s no way to set resolution in meters if you work in latlong. Hence the recommendation to work in projected systems.

Some modules might use distance in meters for certain parameters even when working in latlong, because they convert such distances within the source code into radians (if I’m not mistaken). If not, they will raise a warning. Again, to avoid such issues, it’s a good practice to work with projected CRS.

best,

Vero

El lun, 23 nov 2020 a las 22:46, BHARATH RAM (<br11@iitbbs.ac.in>) escribió:

Dear Ms.Veronica Andreo,
Thank you very much for your quick reply. Yes your suggestion works correctly.

But I find it a litttle suprising since in the documentation (for modukes like r.resample.stats, r.sun etc…) & in several examples meter seems to be the default units used for distance and I assumed that for my case as well it was the same (even though g.region -p prints out in decimal degree).

Is there any way to change the units back to meter as default?

Thank you
Regards,

Bharath

On Tue, Nov 24, 2020, 3:03 AM Veronica Andreo <veroandreo@gmail.com> wrote:

Hello Bharath,

I think your problem is that you are working in a latlong location and trying to set a resolution of 8000 degrees, which is not possible. If your desired final resolution is ~8 km, you will need to set the region resolution to its equivalent in degrees (the unit of latlong CRS). Otherwise, work with projected CRS like UTM for example (recommended).

Furthermore, if you want to go from high res to lower res (upscaling), r.resamp.stats is your friend, so the second approach would be fine. The problem lays in the resolution you are setting.

HTH,

Vero

El lun, 23 nov 2020 a las 22:20, BHARATH RAM (<br11@iitbbs.ac.in>) escribió:

Hello everyone,

I am interested in performing resampling of a fine resolution DEM Model (which is imported as a GTiff file in grass GIS). I tried the following 2 approaches and neither of them was successful. Can you help me figure out where I went wrong? Thanks in Advance.

Details about originally imported DEM model:
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 29N
south: 28:06N
west: 72E
east: 77:24E
nsres: 0:00:01.08
ewres: 0:00:01.08
rows: 3000
cols: 18000
cells: 54000000

MY AIM: To convert a fine grid DEM (30 m resolution) to coarse grid DEM (8km)

APPROACH 1: Using r.resample.rst

g.region raster=test5_r1
r.resamp.rst input=test5_r1 ew_res=8000 ns_res=8000

In this second command’s execution, I get error (log attached below):
Processing all selected output files will require 4 bytes of disk space for temp files.
Temporarily changing the region to desired resolution …
Changing back to the original region …
Percent complete:
ERROR: Unable to seek: Invalid argument

APPROACH 2: Using r.resample.stats
g.region raster=test5_r1
g.region nsres=8000 ewres=8000 // problematic part
r.resamp.stats -w input=test5_r1 output=test5_r1_8km
In this second command’s execution the entire map seems to get clubbed into a single large pixel. I have attached results of g.region -ap below:
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 29N
south: 28:06N
west: 72E
east: 77:24E
nsres: 0:54
ewres: 5:24
rows: 1
cols: 1
cells: 1

Also, can you tell me which method will be more suitable for my final goal?

Thanks & Regards,
Bharath


Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited._______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.


Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.