-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
r.out.ascii: Create an option to write a LISFLOOD compatible header #4695
base: main
Are you sure you want to change the base?
Changes from all commits
94ef812
3147cc6
e4c3a6f
3b1cd28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -44,6 +44,7 @@ int main(int argc, char *argv[]) | |||
struct Flag *noheader; | ||||
struct Flag *surfer; | ||||
struct Flag *modflow; | ||||
struct Flag *lisflood; | ||||
struct Flag *int_out; | ||||
} flag; | ||||
|
||||
|
@@ -54,6 +55,9 @@ int main(int argc, char *argv[]) | |||
G_add_keyword(_("export")); | ||||
G_add_keyword(_("output")); | ||||
G_add_keyword("ASCII"); | ||||
G_add_keyword("Surfer"); | ||||
G_add_keyword("Modflow"); | ||||
G_add_keyword("Lisflood"); | ||||
module->description = | ||||
_("Converts a raster map layer into a GRASS ASCII text file."); | ||||
|
||||
|
@@ -97,6 +101,10 @@ int main(int argc, char *argv[]) | |||
flag.modflow->key = 'm'; | ||||
flag.modflow->description = _("Write MODFLOW (USGS) ASCII array"); | ||||
|
||||
flag.lisflood = G_define_flag(); | ||||
flag.lisflood->key = 'l'; | ||||
flag.lisflood->description = _("Write LISFLOOD (EU) ASCII array"); | ||||
|
||||
flag.int_out = G_define_flag(); | ||||
flag.int_out->key = 'i'; | ||||
flag.int_out->description = _("Force output of integer values"); | ||||
|
@@ -123,7 +131,13 @@ int main(int argc, char *argv[]) | |||
G_fatal_error(_("Both -s and -h doesn't make sense")); | ||||
|
||||
if (flag.surfer->answer && flag.modflow->answer) | ||||
G_fatal_error(_("Use -M or -s, not both")); | ||||
G_fatal_error(_("Use -m or -s, not both")); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [clang-format] reported by reviewdog 🐶
Suggested change
|
||||
if (flag.surfer->answer && flag.lisflood->answer) | ||||
G_fatal_error(_("Use -l or -s, not both")); | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [clang-format] reported by reviewdog 🐶
Suggested change
|
||||
if (flag.lisflood->answer && flag.modflow->answer) | ||||
G_fatal_error(_("Use -m or -l, not both")); | ||||
|
||||
name = parm.map->answer; | ||||
|
||||
|
@@ -168,6 +182,11 @@ int main(int argc, char *argv[]) | |||
writeMFheader(fp, dp, width, out_type); | ||||
rc = write_MODFLOW(fd, fp, nrows, ncols, out_type, dp, width); | ||||
} | ||||
else if (flag.lisflood->answer) { | ||||
if (!flag.noheader->answer) | ||||
writeLISFLOODheader(fp, null_str); | ||||
rc = write_GRASS(fd, fp, nrows, ncols, out_type, dp, null_str); | ||||
} | ||||
else { | ||||
if (!flag.noheader->answer) | ||||
writeGRASSheader(fp); | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶