main.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /****************************************************************************
  2. *
  3. * MODULE: r.surf.gauss
  4. * AUTHOR(S): Jo Wood, 19th October, 24th October 1991 (original contributor)
  5. * Midlands Regional Research Laboratory (ASSIST)
  6. * PURPOSE:
  7. * COPYRIGHT: (C) 1999-2007 by the GRASS Development Team
  8. *
  9. * This program is free software under the GNU General Public
  10. * License (>=v2). Read the file COPYING that comes with GRASS
  11. * for details.
  12. *
  13. *****************************************************************************/
  14. #include <stdlib.h>
  15. #include <stdio.h>
  16. #include <grass/gis.h>
  17. #include <grass/gmath.h>
  18. #include <grass/glocale.h>
  19. #include "local_proto.h"
  20. int main(int argc, char *argv[])
  21. {
  22. /****** INITIALISE ******/
  23. double gauss_mean, gauss_sigma;
  24. struct GModule *module;
  25. struct Option *out;
  26. struct Option *mean;
  27. struct Option *sigma;
  28. G_gisinit(argv[0]);
  29. module = G_define_module();
  30. G_add_keyword(_("raster"));
  31. G_add_keyword(_("surface"));
  32. G_add_keyword(_("random"));
  33. module->label =
  34. _("Generates a raster map using gaussian "
  35. "random number generator.");
  36. module->description = _("Mean and standard deviation of gaussian deviates "
  37. "can be expressed by the user.");
  38. out = G_define_standard_option(G_OPT_R_OUTPUT);
  39. mean = G_define_option();
  40. mean->key = "mean";
  41. mean->description = _("Distribution mean");
  42. mean->type = TYPE_DOUBLE;
  43. mean->answer = "0.0";
  44. sigma = G_define_option();
  45. sigma->key = "sigma";
  46. sigma->description = _("Standard deviation");
  47. sigma->type = TYPE_DOUBLE;
  48. sigma->answer = "1.0";
  49. if (G_parser(argc, argv))
  50. exit(EXIT_FAILURE);
  51. sscanf(mean->answer, "%lf", &gauss_mean);
  52. sscanf(sigma->answer, "%lf", &gauss_sigma);
  53. gaussurf(out->answer, gauss_mean, gauss_sigma);
  54. exit(EXIT_SUCCESS);
  55. }