[GRASS-user] Python script for template creation -i.atcorr module-reg

2018-10-21 Thread kameswari devi
Hello all,
I m trying to use Create_iwave.py for template creation in grass for
atmopsheric correction.But due to the spectral response values errors
are thrown. here i am sending the rsr i used and error i got .please
suggest me. thakn you

wav(nm)  B10
477 0.3744
478 0.6864
480 1
481 0.8624
482 0.6018
483 0.4434
484
485
486 0.377
487 0.667
488 0.968
489 1
490 0.760
491 0.590
492 0.455

ERROR:
python 2.7.13
y=self._evaluate(x)
File"C"\*\interpolate.py",line 618,in_check_bounds
raise valueError("A value in x_new is above the interpolation"
ValueError: A value in x_new is above the interpolation range.

I have given rsr of hyperspectral sensor with narrow wavelength ranges
initially but same error is coming.I tried truncate bounds but of no
use.
Actually i am new to python. so what function it internally using for
generation of interpolated template is not understood.Values should be
of 10nm or lesser or also can be used?
please provide me the solution.


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

Re: [GRASS-user] d.rast in python script

2018-10-21 Thread Frank David

Hello Laurent,

Thank you for your help. I'm very surprised by the complexity of the way 
to display a raster. I thought that only d.rast was needed. Other grass 
command are so simple to use...


Anayway, I don't understand why you need to set a image width and 
height. is it pixel number between west to east and south to north from 
region ?


and from where "img_file_name" is coming ? (my layer's name is "my_map")

To remove raster from display, I just manually remove from the layer tree.

Cheers,

Frank


Le 20/10/2018 à 23:06, Laurent C. a écrit :

Hello Frank,

It is not very straightforward, but it is possible.
Here is an example on how I do it:

import os
import grass.script as gscript
from grass.pygrass.gis.region import Region

# Set general env
os.environ['GRASS_RENDER_IMMEDIATE'] = "cairo"
os.environ['GRASS_RENDER_FILE_COMPRESSION'] = "9"
os.environ['GRASS_RENDER_FILE_READ'] = "TRUE"

# Set image size using the region
region = Region()
xr = region.cols
yr = region.rows
ratio = xr/yr
height = int(WIDTH / ratio)  # Choose the width you like
os.environ['GRASS_RENDER_WIDTH'] = str(WIDTH)
os.environ['GRASS_RENDER_HEIGHT'] = str(height)

# Then you can draw
os.environ['GRASS_RENDER_FILE'] = img_file_name
gscript.run_command('d.rast', map=my_map, quiet=True)


Be aware that every time you run your script, it will add layer on the 
file.

So you might want to delete the png file between the runs.

Cheers,
Laurent

Le ven. 19 oct. 2018 à 13:00, Frank David > a écrit :

>
> Hello,
>
> I wrote some python script and I do not find how to display created
> rasters.
>
> I tried to use d.rast but I believe this command is not designed to be
> used in python script (no monitor available with d.mon -l). Am I wright
> ? so how to do ?...
>
> Thank you for your help.
>
> Frank
>
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org 
> https://lists.osgeo.org/mailman/listinfo/grass-user


--
*Geophom*
327 rue de Vieille Cour 44521 OUDON
Tel +33(0)2 85 52 02 59 - Port +33(0)6 04 47 91 06
www.geophom.fr
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user