[prev in list] [next in list] [prev in thread] [next in thread]
List: grass-commit
Subject: [GRASS-SVN] r67437 - in grass-addons/grass7/imagery: . i.eb.deltat
From: svn_grass () osgeo ! org
Date: 2015-12-30 17:57:43
Message-ID: 20151230175743.ECEFC39012E () trac ! osgeo ! org
[Download RAW message or body]
Author: ychemin
Date: 2015-12-30 09:57:43 -0800 (Wed, 30 Dec 2015)
New Revision: 67437
Added:
grass-addons/grass7/imagery/i.eb.deltat/
grass-addons/grass7/imagery/i.eb.deltat/i.eb.deltat.html
Removed:
grass-addons/grass7/imagery/i.eb.deltat/description.html
Modified:
grass-addons/grass7/imagery/Makefile
grass-addons/grass7/imagery/i.eb.deltat/Makefile
grass-addons/grass7/imagery/i.eb.deltat/main.c
Log:
upgraded i.eb.deltat to grass v7
Modified: grass-addons/grass7/imagery/Makefile
===================================================================
--- grass-addons/grass7/imagery/Makefile 2015-12-30 17:49:54 UTC (rev 67436)
+++ grass-addons/grass7/imagery/Makefile 2015-12-30 17:57:43 UTC (rev 67437)
@@ -3,6 +3,7 @@
# i.fusion.brovey deprecated
SUBDIRS = \
+ i.alti \
i.destripe \
i.eb.hsebal95 \
i.eb.z0m \
Modified: grass-addons/grass7/imagery/i.eb.deltat/Makefile
===================================================================
--- grass-addons/grass6/imagery/gipe/i.eb.deltat/Makefile 2015-12-30 15:21:39 UTC \
(rev 67434)
+++ grass-addons/grass7/imagery/i.eb.deltat/Makefile 2015-12-30 17:57:43 UTC (rev \
67437) @@ -2,13 +2,9 @@
PGM = i.eb.deltat
-LIBES = $(GISLIB)
-DEPENDENCIES = $(GISDEP)
+LIBES = $(GISLIB) $(RASTERLIB)
+DEPENDENCIES = $(GISDEP) $(RASTERDEP)
include $(MODULE_TOPDIR)/include/Make/Module.make
-ifneq ($(USE_LARGEFILES),)
- EXTRA_CFLAGS = -D_FILE_OFFSET_BITS=64
-endif
-
default: cmd
Deleted: grass-addons/grass7/imagery/i.eb.deltat/description.html
===================================================================
--- grass-addons/grass6/imagery/gipe/i.eb.deltat/description.html 2015-12-30 15:21:39 \
UTC (rev 67434)
+++ grass-addons/grass7/imagery/i.eb.deltat/description.html 2015-12-30 17:57:43 UTC \
(rev 67437) @@ -1,23 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>i.eb.deltat</em> calculates the difference of temperature between two heights. \
Generally considered between surface skin temperature and air temperature ~2m above \
the skin (soil/canopy/etc). This approximation is found in Pawan (2004) and is used \
for initialization of the sensible heat flux iterations in SEBAL (Bastiaanssen, \
1995).
-<h2>NOTES</h2>
-This is found in Pawan (2004). This is the case of a Landsat satellite image of Oct \
8, 2003, located in Portugal. He also mentions a strange equation for MODIS of \
January 13, 2003. delta T = -3440.37 +12.18404 * LST. Of course the intercept looks \
like the LST band is still in storage format (*10000).
-Additionally, it is worth menitoning that Pawan only created this map once, and used \
it all the time. This is certainly because he created the relationship from some \
field data and found it reliable enough not to modify this parameter anymore, leading \
to a simplified iteration process of SEBAL, changing only the rah parameter through \
the iterations of H,L,psi,rah.
-<h2>TODO</h2>
-
-
-<h2>SEE ALSO</h2>
-
-<em>
-<a href="i.eb.h0.html">i.eb.h0</a><br>
-</em>
-
-
-<h2>AUTHORS</h2>
-
-Yann Chemin, Asian Institute of Technology, Thailand<br>
-
-
-<p>
-<i>Last changed: $Date$</i>
Copied: grass-addons/grass7/imagery/i.eb.deltat/i.eb.deltat.html (from rev 67434, \
grass-addons/grass6/imagery/gipe/i.eb.deltat/description.html) \
===================================================================
--- grass-addons/grass7/imagery/i.eb.deltat/i.eb.deltat.html \
(rev 0)
+++ grass-addons/grass7/imagery/i.eb.deltat/i.eb.deltat.html 2015-12-30 17:57:43 UTC \
(rev 67437) @@ -0,0 +1,23 @@
+<h2>DESCRIPTION</h2>
+
+<em>i.eb.deltat</em> calculates the difference of temperature between two heights. \
Generally considered between surface skin temperature and air temperature ~2m above \
the skin (soil/canopy/etc). This approximation is found in Pawan (2004) and is used \
for initialization of the sensible heat flux iterations in SEBAL (Bastiaanssen, \
1995). +<h2>NOTES</h2>
+This is found in Pawan (2004). This is the case of a Landsat satellite image of Oct \
8, 2003, located in Portugal. He also mentions a strange equation for MODIS of \
January 13, 2003. delta T = -3440.37 +12.18404 * LST. Of course the intercept looks \
like the LST band is still in storage format (*10000). +Additionally, it is worth \
menitoning that Pawan only created this map once, and used it all the time. This is \
certainly because he created the relationship from some field data and found it \
reliable enough not to modify this parameter anymore, leading to a simplified \
iteration process of SEBAL, changing only the rah parameter through the iterations of \
H,L,psi,rah. +<h2>TODO</h2>
+
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a href="i.eb.h0.html">i.eb.h0</a><br>
+</em>
+
+
+<h2>AUTHORS</h2>
+
+Yann Chemin, Asian Institute of Technology, Thailand<br>
+
+
+<p>
+<i>Last changed: $Date$</i>
Modified: grass-addons/grass7/imagery/i.eb.deltat/main.c
===================================================================
--- grass-addons/grass6/imagery/gipe/i.eb.deltat/main.c 2015-12-30 15:21:39 UTC (rev \
67434)
+++ grass-addons/grass7/imagery/i.eb.deltat/main.c 2015-12-30 17:57:43 UTC (rev \
67437) @@ -7,7 +7,7 @@
* as seen in Pawan (2004)
* This is a SEBAL initialization parameter for sensible heat.
*
- * COPYRIGHT: (C) 2006 by the GRASS Development Team
+ * COPYRIGHT: (C) 2006-2016 by the GRASS Development Team
*
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
@@ -20,65 +20,48 @@
#include <stdlib.h>
#include <string.h>
#include <grass/gis.h>
+#include <grass/raster.h>
#include <grass/glocale.h>
double delta_t(double tempk);
int main(int argc, char *argv[])
{
struct Cell_head cellhd; /*region+header info */
-
char *mapset; /* mapset name */
-
int nrows, ncols;
-
int row, col;
-
int wim = 0;
-
struct GModule *module;
-
struct Option *input1, *output1;
-
struct Flag *flag1, *flag2;
-
struct History history; /*metadata */
-
-
-
- /************************************/
- /* FMEO Declarations**************** */
char *name; /*input raster name */
-
char *result1; /*output raster name */
-
-
- /*File Descriptors */
+ /*File Descriptors */
int infd_tempk;
-
int outfd1;
-
char *tempk;
-
char *delta;
-
int i = 0, j = 0;
-
void *inrast_tempk;
DCELL * outrast1;
RASTER_MAP_TYPE data_type_output = DCELL_TYPE;
RASTER_MAP_TYPE data_type_tempk;
-
- /************************************/
- G_gisinit(argv[0]);
+ /************************************/
+ G_gisinit(argv[0]);
module = G_define_module();
- module->keywords = _("delta T, energy balance, SEBAL");
+ G_add_keyword(_("imagery"));
+ G_add_keyword(_("energy balance"));
+ G_add_keyword(_("SEBAL"));
+ G_add_keyword(_("SEBS"));
+ G_add_keyword(_("delta T"));
module->description =
_("difference of temperature between two heights as seen in Pawan (2004), this is \
part of sensible heat flux calculations, as in SEBAL (Bastiaanssen, 1995). A 'w' flag \
allows for a very generic approximation.");
- /* Define the different options */
- input1 = G_define_standard_option(G_OPT_R_INPUT);
+ /* Define the different options */
+ input1 = G_define_standard_option(G_OPT_R_INPUT);
input1->key = _("tempk");
input1->description =
_("Name of the surface skin temperature map [Kelvin]");
@@ -91,53 +74,43 @@
flag2->key = 'w';
flag2->description = _("Wim's generic table");
-
- /********************/
- if (G_parser(argc, argv))
+ /********************/
+ if (G_parser(argc, argv))
exit(EXIT_FAILURE);
tempk = input1->answer;
result1 = output1->answer;
wim = flag2->answer;
-
- /***************************************************/
- mapset = G_find_cell2(tempk, "");
- if (mapset == NULL) {
- G_fatal_error(_("cell file [%s] not found"), tempk);
- }
- data_type_tempk = G_raster_map_type(tempk, mapset);
- if ((infd_tempk = G_open_cell_old(tempk, mapset)) < 0)
+ /***************************************************/
+ data_type_tempk = Rast_map_type(tempk, mapset);
+ if ((infd_tempk = Rast_open_old(tempk, mapset)) < 0)
G_fatal_error(_("Cannot open cell file [%s]"), tempk);
- if (G_get_cellhd(tempk, mapset, &cellhd) < 0)
- G_fatal_error(_("Cannot read file header of [%s])"), tempk);
- inrast_tempk = G_allocate_raster_buf(data_type_tempk);
+ Rast_get_cellhd(tempk, mapset, &cellhd);
+ inrast_tempk = Rast_allocate_buf(data_type_tempk);
-
- /***************************************************/
- G_debug(3, "number of rows %d", cellhd.rows);
- nrows = G_window_rows();
- ncols = G_window_cols();
- outrast1 = G_allocate_raster_buf(data_type_output);
+ /***************************************************/
+ G_debug(3, "number of rows %d", cellhd.rows);
+ nrows = Rast_window_rows();
+ ncols = Rast_window_cols();
+ outrast1 = Rast_allocate_buf(data_type_output);
- /* Create New raster files */
- if ((outfd1 = G_open_raster_new(result1, data_type_output)) < 0)
- G_fatal_error(_("Could not open <%s>"), result1);
+ /* Create New raster files */
+ outfd1 = Rast_open_new(result1, data_type_output);
- /* Process pixels */
+ /* Process pixels */
for (row = 0; row < nrows; row++)
- {
- DCELL d;
- DCELL d_tempk;
- G_percent(row, nrows, 2);
+ {
+ DCELL d;
+ DCELL d_tempk;
+ G_percent(row, nrows, 2);
/* read soil input maps */
- if (G_get_raster_row
- (infd_tempk, inrast_tempk, row, data_type_tempk) < 0)
- G_fatal_error(_("Could not read from <%s>"), tempk);
+ Rast_get_row
+ (infd_tempk, inrast_tempk, row, data_type_tempk);
/*process the data */
for (col = 0; col < ncols; col++)
- {
+ {
switch (data_type_tempk) {
case CELL_TYPE:
d_tempk = (double)((CELL *) inrast_tempk)[col];
@@ -149,15 +122,13 @@
d_tempk = ((DCELL *) inrast_tempk)[col];
break;
}
- if (G_is_d_null_value(&d_tempk)) {
- G_set_d_null_value(&outrast1[col], 1);
+ if (Rast_is_d_null_value(&d_tempk)) {
+ Rast_set_d_null_value(&outrast1[col], 1);
}
else {
-
-
- /****************************/
- /* calculate delta T */
- if (wim) {
+ /****************************/
+ /* calculate delta T */
+ if (wim) {
d = 0.3225 * d_tempk - 91.743;
if (d < 1) {
d = 1.0;
@@ -170,21 +141,20 @@
d = delta_t(d_tempk);
}
if (abs(d) > 50.0) {
- G_set_d_null_value(&outrast1[col], 1);
+ Rast_set_d_null_value(&outrast1[col], 1);
}
outrast1[col] = d;
}
- }
- if (G_put_raster_row(outfd1, outrast1, data_type_output) < 0)
- G_fatal_error(_("Cannot write to output raster file"));
}
- G_free(inrast_tempk);
- G_close_cell(infd_tempk);
- G_free(outrast1);
- G_close_cell(outfd1);
- G_short_history(result1, "raster", &history);
- G_command_history(&history);
- G_write_history(result1, &history);
+ Rast_put_row(outfd1, outrast1, data_type_output);
+ }
+ free(inrast_tempk);
+ Rast_close(infd_tempk);
+ free(outrast1);
+ Rast_close(outfd1);
+ Rast_short_history(result1, "raster", &history);
+ Rast_command_history(&history);
+ Rast_write_history(result1, &history);
exit(EXIT_SUCCESS);
}
_______________________________________________
grass-commit mailing list
grass-commit@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-commit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic