[GRASS-SVN] r30823 - in grass-addons/gipe: i.dn2potrad.l5
i.evapo.SENAY i.latitude
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 31 00:06:12 EDT 2008
Author: ychemin
Date: 2008-03-31 00:06:12 -0400 (Mon, 31 Mar 2008)
New Revision: 30823
Modified:
grass-addons/gipe/i.dn2potrad.l5/main.c
grass-addons/gipe/i.evapo.SENAY/main.c
grass-addons/gipe/i.latitude/main.c
Log:
bug fixing
Modified: grass-addons/gipe/i.dn2potrad.l5/main.c
===================================================================
--- grass-addons/gipe/i.dn2potrad.l5/main.c 2008-03-31 02:46:04 UTC (rev 30822)
+++ grass-addons/gipe/i.dn2potrad.l5/main.c 2008-03-31 04:06:12 UTC (rev 30823)
@@ -31,12 +31,12 @@
#define MAXFILES 7
//sun exo-atmospheric irradiance
-#define KEXO1 1957.0
-#define KEXO2 1826.0
-#define KEXO3 1554.0
-#define KEXO4 1036.0
-#define KEXO5 215.0
-#define KEXO6 80.67
+#define KEXO1 1969.0
+#define KEXO2 1840.0
+#define KEXO3 1551.0
+#define KEXO4 1044.0
+#define KEXO5 225.7
+#define KEXO6 82.07
#define PI 3.1415926
@@ -198,21 +198,21 @@
temp = year - 2000;
}
if (temp >=10){
- snprintf(b1, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B1.tif");
- snprintf(b2, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B2.tif");
- snprintf(b3, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B3.tif");
- snprintf(b4, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B4.tif");
- snprintf(b5, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B5.tif");
- snprintf(b6, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B6.tif");
- snprintf(b7, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B7.tif");
+ sprintf(b1, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B1.tif");
+ sprintf(b2, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B2.tif");
+ sprintf(b3, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B3.tif");
+ sprintf(b4, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B4.tif");
+ sprintf(b5, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B5.tif");
+ sprintf(b6, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B6.tif");
+ sprintf(b7, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"00",temp,doy,"50_B7.tif");
} else {
- snprintf(b1, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B1.tif");
- snprintf(b2, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B2.tif");
- snprintf(b3, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B3.tif");
- snprintf(b4, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B4.tif");
- snprintf(b5, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B5.tif");
- snprintf(b6, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B6.tif");
- snprintf(b7, 80, "%s%s%s%s%s%s%s%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B7.tif");
+ sprintf(b1, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B1.tif");
+ sprintf(b2, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B2.tif");
+ sprintf(b3, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B3.tif");
+ sprintf(b4, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B4.tif");
+ sprintf(b5, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B5.tif");
+ sprintf(b6, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B6.tif");
+ sprintf(b7, "%s%d%s%d%s%d%d%s","LT5",l5path,"0",l5row,"000",temp,doy,"50_B7.tif");
}
/********************/
@@ -224,8 +224,7 @@
kexo[2]=KEXO3;
kexo[3]=KEXO4;
kexo[4]=KEXO5;
- kexo[5]=KEXO6;/*filling*/
- kexo[6]=KEXO6;
+ kexo[5]=KEXO6;
//******************************************
/***************************************************/
Modified: grass-addons/gipe/i.evapo.SENAY/main.c
===================================================================
--- grass-addons/gipe/i.evapo.SENAY/main.c 2008-03-31 02:46:04 UTC (rev 30822)
+++ grass-addons/gipe/i.evapo.SENAY/main.c 2008-03-31 04:06:12 UTC (rev 30823)
@@ -70,8 +70,8 @@
RASTER_MAP_TYPE data_type_aspect;
/********************************/
/* Stats for Senay equation */
- double t0dem_min,t0dem_max;
- double tempk_min,tempk_max;
+ double t0dem_min=400.0,t0dem_max=200.0;
+ double tempk_min=400.0,tempk_max=200.0;
/********************************/
G_gisinit(argv[0]);
@@ -91,9 +91,9 @@
input2->answer =_("tempk");
input3 = G_define_standard_option(G_OPT_R_INPUT) ;
- input3->key =_("tempk");
- input3->description=_("Name of the temperature map [Degree Kelvin]");
- input3->answer =_("tempk");
+ input3->key =_("dem");
+ input3->description=_("Name of the elevation map [m]");
+ input3->answer =_("dem");
input4 = G_define_standard_option(G_OPT_R_INPUT) ;
input4->key =_("lat");
@@ -316,9 +316,11 @@
/* do nothing */
} else {
if(d_t0dem<t0dem_min){
+ //if(d_tempk<tempk_min){
t0dem_min=d_t0dem;
tempk_min=d_tempk;
}else if(d_t0dem>t0dem_max){
+ //}else if(d_tempk>tempk_max){
t0dem_max=d_t0dem;
tempk_max=d_tempk;
}
@@ -326,6 +328,7 @@
}
}
}
+ G_message("tempk_min=%f\ntempk_max=%f\n",tempk_min, tempk_max);
/* Process pixels */
for (row = 0; row < nrows; row++)
{
Modified: grass-addons/gipe/i.latitude/main.c
===================================================================
--- grass-addons/gipe/i.latitude/main.c 2008-03-31 02:46:04 UTC (rev 30822)
+++ grass-addons/gipe/i.latitude/main.c 2008-03-31 04:06:12 UTC (rev 30823)
@@ -1,10 +1,10 @@
/****************************************************************************
*
- * MODULE: i.longitude
- * AUTHOR(S): Yann Chemin - ychemin at gmail.com
+ * MODULE: i.latitude
+ * AUTHOR(S): Yann Chemin - yann.chemin at gmail.com
* PURPOSE: Calculates the longitude of the pixels in the map.
*
- * COPYRIGHT: (C) 2002-2006 by the GRASS Development Team
+ * COPYRIGHT: (C) 2008 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
@@ -26,7 +26,6 @@
int nrows, ncols;
int row,col;
- int verbose=1;
int not_ll=0;//if proj is not lat/long, it will be 1.
struct GModule *module;
struct Option *input1, *output1;
@@ -60,8 +59,8 @@
G_gisinit(argv[0]);
module = G_define_module();
- module->keywords = _("longitude, projection");
- module->description = _("creates a longitude map");
+ module->keywords = _("latitude, projection");
+ module->description = _("creates a latitude map");
/* Define the different options */
input1 = G_define_standard_option(G_OPT_R_INPUT) ;
@@ -70,20 +69,16 @@
input1->answer =_("input");
output1 = G_define_standard_option(G_OPT_R_OUTPUT) ;
- output1->key =_("longitude");
- output1->description=_("Name of the output longitude layer");
- output1->answer =_("longitude");
+ output1->key =_("latitude");
+ output1->description=_("Name of the output latitude layer");
+ output1->answer =_("latitude");
- flag1 = G_define_flag();
- flag1->key = 'q';
- flag1->description = _("Quiet");
/********************/
if (G_parser(argc, argv))
exit (EXIT_FAILURE);
in = input1->answer;
result1 = output1->answer;
- verbose = (!flag1->answer);
/***************************************************/
mapset = G_find_cell2(in, "");
if (mapset == NULL) {
@@ -136,9 +131,8 @@
for (row = 0; row < nrows; row++)
{
DCELL d;
- DCELL d_lon;
- if(verbose)
- G_percent(row,nrows,2);
+ DCELL d_lat;
+ G_percent(row,nrows,2);
if(G_get_raster_row(infd,inrast,row,data_type_inrast)<0)
G_fatal_error(_("Could not read from <%s>"),in);
for (col=0; col < ncols; col++)
@@ -152,8 +146,8 @@
}else{
//Do nothing
}
- d_lon = longitude;
- ((DCELL *) outrast1)[col] = d_lon;
+ d_lat = latitude;
+ ((DCELL *) outrast1)[col] = d_lat;
}
if (G_put_raster_row (outfd1, outrast1, data_type_output) < 0)
G_fatal_error(_("Cannot write to output raster file"));
More information about the grass-commit
mailing list