[GRASS-SVN] r64241 - in grass-addons/grass7/imagery: . i.spec.sam
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 19 08:16:24 PST 2015
Author: ychemin
Date: 2015-01-19 08:16:24 -0800 (Mon, 19 Jan 2015)
New Revision: 64241
Added:
grass-addons/grass7/imagery/i.spec.sam/
Modified:
grass-addons/grass7/imagery/Makefile
grass-addons/grass7/imagery/i.spec.sam/Makefile
grass-addons/grass7/imagery/i.spec.sam/hist.c
grass-addons/grass7/imagery/i.spec.sam/main.c
grass-addons/grass7/imagery/i.spec.sam/open.c
grass-addons/grass7/imagery/i.spec.sam/spectrum.dat
grass-addons/grass7/imagery/i.spec.sam/spectrum2.dat
grass-addons/grass7/imagery/i.spec.sam/test.dat
Log:
porting i.spec.sam to G7
Modified: grass-addons/grass7/imagery/Makefile
===================================================================
--- grass-addons/grass7/imagery/Makefile 2015-01-19 16:10:13 UTC (rev 64240)
+++ grass-addons/grass7/imagery/Makefile 2015-01-19 16:16:24 UTC (rev 64241)
@@ -19,6 +19,7 @@
i.rotate \
i.segment.gsoc \
i.segment.hierarchical \
+ i.spec.sam \
i.spec.unmix \
i.theilsen \
i.vi.mpi \
Modified: grass-addons/grass7/imagery/i.spec.sam/Makefile
===================================================================
--- grass-addons/grass6/imagery/i.spec.sam/Makefile 2015-01-19 13:44:26 UTC (rev 64239)
+++ grass-addons/grass7/imagery/i.spec.sam/Makefile 2015-01-19 16:16:24 UTC (rev 64241)
@@ -2,9 +2,9 @@
PGM = i.spec.sam
-EXTRALIB=meschach.a
-LIBES = $(IMAGERYLIB) $(GMATHLIB) $(GISLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(GMATHDEP) $(GISDEP)
+EXTRALIB = meschach.a
+LIBES = $(IMAGERYLIB) $(GMATHLIB) $(RASTERLIB) $(GISLIB)
+DEPENDENCIES= $(IMAGERYDEP) $(GMATHDEP) $(RASTERDEP) $(GISDEP)
include $(MODULE_TOPDIR)/include/Make/Module.make
Modified: grass-addons/grass7/imagery/i.spec.sam/hist.c
===================================================================
--- grass-addons/grass6/imagery/i.spec.sam/hist.c 2015-01-19 13:44:26 UTC (rev 64239)
+++ grass-addons/grass7/imagery/i.spec.sam/hist.c 2015-01-19 16:16:24 UTC (rev 64241)
@@ -1,14 +1,14 @@
#include <grass/gis.h>
+#include <grass/raster.h>
-void make_history(name, group, matrixfile)
- char *name, *group, *matrixfile;
+void make_history(const char *name, const char *group, const char*matrixfile)
{
struct History hist;
- if(G_read_history (name, G_mapset(), &hist) >= 0)
+ if(Rast_read_history (name, G_mapset(), &hist) >= 0)
{
- sprintf (hist.datsrc_1, "Group: %s", group);
- sprintf (hist.datsrc_2, "Matrix file: %s", matrixfile);
- G_write_history (name, &hist);
+ Rast_format_history(&hist, HIST_DATSRC_1, "Group: %s", group);
+ Rast_format_history(&hist, HIST_DATSRC_2, "Matrix file: %s", matrixfile);
+ Rast_write_history (name, &hist);
}
}
Modified: grass-addons/grass7/imagery/i.spec.sam/main.c
===================================================================
--- grass-addons/grass6/imagery/i.spec.sam/main.c 2015-01-19 13:44:26 UTC (rev 64239)
+++ grass-addons/grass7/imagery/i.spec.sam/main.c 2015-01-19 16:16:24 UTC (rev 64241)
@@ -143,8 +143,8 @@
}
/* alright, start Spectral angle mapping */
- nrows = G_window_rows();
- ncols = G_window_cols();
+ nrows = Rast_window_rows();
+ ncols = Rast_window_cols();
if (!flag.quiet->answer)
{
@@ -156,10 +156,7 @@
if (!flag.quiet->answer)
G_percent(row, nrows, 2);
for (band = 0; band < Ref.nfiles; band++) /* get row for all bands*/
- {
- if (G_get_map_row (cellfd[band], cell[band], row) < 0)
- exit(1);
- }
+ Rast_get_c_row (cellfd[band], cell[band], row);
for (col = 0; col < ncols; col++) /* cols loop, work pixelwise for all bands */
{
@@ -186,7 +183,7 @@
/* write the resulting rows: */
for (i = 0; i < Ref.nfiles; i++)
- G_put_map_row (resultfd[i], result_cell[i]);
+ Rast_put_c_row (resultfd[i], result_cell[i]);
} /* rows loop */
@@ -196,8 +193,8 @@
/* close files */
for (i = 0; i < Ref.nfiles; i++)
{
- G_close_cell (resultfd[i]);
- G_unopen_cell(cellfd[i]);
+ Rast_close (resultfd[i]);
+ Rast_unopen(cellfd[i]);
/* make grey scale color table */
sprintf(result_name, "%s.%d", result_prefix, (i+1));
sprintf(command, "r.colors map=%s color=grey >/dev/null", result_name);
Modified: grass-addons/grass7/imagery/i.spec.sam/open.c
===================================================================
--- grass-addons/grass6/imagery/i.spec.sam/open.c 2015-01-19 13:44:26 UTC (rev 64239)
+++ grass-addons/grass7/imagery/i.spec.sam/open.c 2015-01-19 16:16:24 UTC (rev 64241)
@@ -17,6 +17,7 @@
#include <stdio.h>
#include <math.h>
#include <grass/gis.h>
+#include <grass/raster.h>
#include "matrix.h"
int open_files()
@@ -77,12 +78,12 @@
cellfd = (int *) G_malloc (Ref.nfiles * sizeof (int));
for (i=0; i < Ref.nfiles; i++)
{
- cell[i] = G_allocate_cell_buf();
+ cell[i] = Rast_allocate_c_buf();
name = Ref.file[i].name;
mapset = Ref.file[i].mapset;
if (!flag.quiet->answer)
fprintf (stderr,"Opening input file no. %i [%s]\n", (i+1), name);
- if ((cellfd[i] = G_open_cell_old (name, mapset)) < 0)
+ if ((cellfd[i] = Rast_open_old (name, mapset)) < 0)
{
fprintf (stderr, "Unable to proceed\n");
exit(1);
@@ -97,8 +98,8 @@
sprintf(result_name, "%s.%d", result_prefix, (i+1));
if (!flag.quiet->answer)
fprintf (stderr,"Opening output file [%s]\n", result_name);
- result_cell[i] = G_allocate_cell_buf();
- if ((resultfd[i] = G_open_cell_new (result_name)) <0)
+ result_cell[i] = Rast_allocate_c_buf();
+ if ((resultfd[i] = Rast_open_c_new (result_name)) <0)
{
fprintf (stderr, "Unable to proceed\n");
exit(1) ;
Modified: grass-addons/grass7/imagery/i.spec.sam/spectrum.dat
===================================================================
--- grass-addons/grass6/imagery/i.spec.sam/spectrum.dat 2015-01-19 13:44:26 UTC (rev 64239)
+++ grass-addons/grass7/imagery/i.spec.sam/spectrum.dat 2015-01-19 16:16:24 UTC (rev 64241)
@@ -1,9 +1,9 @@
-# Kanäle: r g b i1 i2 i3
+# Band: r g b i1 i2 i3
# Spektren zeilenweise eingeben!
# 1. Sagebrush
# 2. Saltbush
-# 3. Boden
-# 4. Trockengras
+# 3. Ground
+# 4. Dry Grass
#
Matrix: 4 by 4
row0: 8.87 13.14 11.71 35.85
Modified: grass-addons/grass7/imagery/i.spec.sam/spectrum2.dat
===================================================================
--- grass-addons/grass6/imagery/i.spec.sam/spectrum2.dat 2015-01-19 13:44:26 UTC (rev 64239)
+++ grass-addons/grass7/imagery/i.spec.sam/spectrum2.dat 2015-01-19 16:16:24 UTC (rev 64241)
@@ -1,9 +1,9 @@
-# Kanäle: r g b i1 i2 i3
-# Spektren zeilenweise eingeben!
-# 1. Wald
-# 2. helles Feld
-# 3. Boden
-# 4. Trockengras
+# Bands: r g b i1 i2 i3
+# Enter spectra line by line!
+# 1. Forest
+# 2. bright Field
+# 3. Ground
+# 4. Dry grass
#
Matrix: 4 by 4
row0: 38 31 16 67
Modified: grass-addons/grass7/imagery/i.spec.sam/test.dat
===================================================================
--- grass-addons/grass6/imagery/i.spec.sam/test.dat 2015-01-19 13:44:26 UTC (rev 64239)
+++ grass-addons/grass7/imagery/i.spec.sam/test.dat 2015-01-19 16:16:24 UTC (rev 64241)
@@ -1,5 +1,5 @@
-# Kanäle: r g b i1 i2 i3
-# Spektren zeilenweise eingeben!
+# Bands: r g b i1 i2 i3
+# Enter spectra line by line!
#
Matrix: 4 by 4
row0: 54 83 44 13
More information about the grass-commit
mailing list