main.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * r.in.gridatb: Imports GRIDATB.FOR map file (TOPMODEL) into GRASS raster map
  3. *
  4. * GRIDATB.FOR Author: Keith Beven <k.beven@lancaster.ac.uk>
  5. *
  6. * Copyright (C) 2000 by the GRASS Development Team
  7. * Author: Huidae Cho <grass4u@gmail.com>
  8. * Hydro Laboratory, Kyungpook National University
  9. * South Korea
  10. *
  11. * This program is free software under the GPL (>=v2)
  12. * Read the file COPYING coming with GRASS for details.
  13. *
  14. */
  15. #include <stdlib.h>
  16. #include <stdio.h>
  17. #include "local_proto.h"
  18. #include <grass/gis.h>
  19. #include <grass/raster.h>
  20. #include <grass/glocale.h>
  21. struct Cell_head cellhd;
  22. FCELL *cell;
  23. const char *file;
  24. const char *mapset, *oname;
  25. int main(int argc, char **argv)
  26. {
  27. struct
  28. {
  29. struct Option *input;
  30. struct Option *output;
  31. } params;
  32. struct GModule *module;
  33. G_gisinit(argv[0]);
  34. /* Set description */
  35. module = G_define_module();
  36. G_add_keyword(_("raster"));
  37. G_add_keyword(_("import"));
  38. module->description =
  39. _("Imports GRIDATB.FOR map file (TOPMODEL) into GRASS raster map");
  40. params.input = G_define_option();
  41. params.input->key = "input";
  42. params.input->description = _("GRIDATB i/o map file");
  43. params.input->type = TYPE_STRING;
  44. params.input->required = YES;
  45. params.output = G_define_option();
  46. params.output->key = "output";
  47. params.output->description = _("Name for output raster map");
  48. params.output->type = TYPE_STRING;
  49. params.output->required = YES;
  50. params.output->gisprompt = "new,cell,raster";
  51. if (G_parser(argc, argv))
  52. exit(EXIT_FAILURE);
  53. file = params.input->answer;
  54. oname = params.output->answer;
  55. mapset = G_mapset();
  56. if (check_ready())
  57. G_fatal_error(_("File not found: %s"), file);
  58. rdwr_gridatb();
  59. exit(EXIT_SUCCESS);
  60. }