[cig-commits] r21003 - mc/1D/hc/trunk

becker at geodynamics.org becker at geodynamics.org
Wed Nov 7 20:46:52 PST 2012


Author: becker
Date: 2012-11-07 20:46:51 -0800 (Wed, 07 Nov 2012)
New Revision: 21003

Modified:
   mc/1D/hc/trunk/ggrd_grdtrack_util.c
   mc/1D/hc/trunk/ggrd_grdtrack_util.h
   mc/1D/hc/trunk/hc_auto_proto.h
Log:
Some small fixes. 



Modified: mc/1D/hc/trunk/ggrd_grdtrack_util.c
===================================================================
--- mc/1D/hc/trunk/ggrd_grdtrack_util.c	2012-11-07 16:31:51 UTC (rev 21002)
+++ mc/1D/hc/trunk/ggrd_grdtrack_util.c	2012-11-08 04:46:51 UTC (rev 21003)
@@ -241,7 +241,45 @@
 				     g->loc_bcr);
   return result;
 }
+
 /* 
+
+this is almost redundant, use lon lat in degrees and z in [km] depth
+
+ */
+ggrd_boolean ggrd_grdtrack_interpolate_lonlatz(double lon,double lat,double z,
+					       struct ggrd_gt *g,
+					       double *value,
+					       ggrd_boolean verbose)
+{
+  double x[3];
+  ggrd_boolean result;
+  if(!g->init){			/* this will not necessarily work */
+    fprintf(stderr,"ggrd_grdtrack_interpolate_rtp: error, g structure not initialized\n");
+    return FALSE;
+  }
+  if(!g->is_three){
+    fprintf(stderr,"ggrd_grdtrack_interpolate_rtp: error, g structure is not 3-D\n");
+    return FALSE;
+  }
+  /* 
+     convert coordinates to lon / lat / z
+  */
+  x[0] = lon;
+  x[1] = lat;
+  x[2] = z;
+  if(g->zlevels_are_negative)	/* adjust for depth */
+    x[2] = -x[2];
+  
+  result = ggrd_grdtrack_interpolate(x,TRUE,g->grd,g->f,
+				     g->edgeinfo,g->mm,g->z,
+				     g->nz,value,verbose,
+				     g->loc_bcr);
+  return result;
+}
+
+
+/* 
    for 3-D  cartesian
 
    interpolation wrapper, uses x, y, z input. return value and TRUE if success,

Modified: mc/1D/hc/trunk/ggrd_grdtrack_util.h
===================================================================
--- mc/1D/hc/trunk/ggrd_grdtrack_util.h	2012-11-07 16:31:51 UTC (rev 21002)
+++ mc/1D/hc/trunk/ggrd_grdtrack_util.h	2012-11-08 04:46:51 UTC (rev 21003)
@@ -37,6 +37,9 @@
 int ggrd_grdtrack_init_general(ggrd_boolean ,char *, char *,char *,
 			       struct ggrd_gt *,ggrd_boolean ,
 			       ggrd_boolean, ggrd_boolean);
+ggrd_boolean ggrd_grdtrack_interpolate_lonlatz(double ,double ,double ,
+					       struct ggrd_gt *,double *,
+					       ggrd_boolean );
 ggrd_boolean ggrd_grdtrack_interpolate_rtp(double ,double ,double ,
 					    struct ggrd_gt *,double *,
 					    ggrd_boolean,ggrd_boolean);

Modified: mc/1D/hc/trunk/hc_auto_proto.h
===================================================================
--- mc/1D/hc/trunk/hc_auto_proto.h	2012-11-07 16:31:51 UTC (rev 21002)
+++ mc/1D/hc/trunk/hc_auto_proto.h	2012-11-08 04:46:51 UTC (rev 21003)
@@ -5,6 +5,7 @@
 int ggrd_grdtrack_init_general(unsigned char, char *, char *, char *, struct ggrd_gt *, unsigned char, unsigned char, unsigned char);
 int ggrd_grdtrack_rescale(struct ggrd_gt *, unsigned char, unsigned char, unsigned char, double);
 unsigned char ggrd_grdtrack_interpolate_rtp(double, double, double, struct ggrd_gt *, double *, unsigned char, unsigned char);
+unsigned char ggrd_grdtrack_interpolate_lonlatz(double, double, double, struct ggrd_gt *, double *, unsigned char);
 unsigned char ggrd_grdtrack_interpolate_xyz(double, double, double, struct ggrd_gt *, double *, unsigned char);
 unsigned char ggrd_grdtrack_interpolate_tp(double, double, struct ggrd_gt *, double *, unsigned char, unsigned char);
 unsigned char ggrd_grdtrack_interpolate_xy(double, double, struct ggrd_gt *, double *, unsigned char);



More information about the CIG-COMMITS mailing list