From 5dde4b685b75c34c02a3b90a31d26cd402df5df0 Mon Sep 17 00:00:00 2001
From: matti <matthias@rauter.it>
Date: Fri, 15 Sep 2023 15:07:16 +0200
Subject: [PATCH] Change order of grid file header to match common layout

---
 src/avalanche/gistools/gridfile.C | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/avalanche/gistools/gridfile.C b/src/avalanche/gistools/gridfile.C
index a6e59b2..de9bff6 100644
--- a/src/avalanche/gistools/gridfile.C
+++ b/src/avalanche/gistools/gridfile.C
@@ -295,11 +295,10 @@ int gridfile::write(const std::string& fname)
         return 0;
     }
 
-    pFile << "xllcenter " << this->xllcenter_ << std::endl
-          << "yllcenter " << this->yllcenter_ << std::endl
+    pFile << "ncols " << this->ncols_ << std::endl
           << "nrows " << this->nrows_ << std::endl
-          << "ncols " << this->ncols_ << std::endl
-          << "NODATA_value " << this->NODATA_value_ << std::endl;
+          << "xllcenter " << this->xllcenter_ << std::endl
+          << "yllcenter " << this->yllcenter_ << std::endl;
 
     if (this->dx_ == this->dy_)
     {
@@ -311,6 +310,8 @@ int gridfile::write(const std::string& fname)
               << "dy " << dy_ << std::endl;
     }
 
+    pFile << "NODATA_value " << this->NODATA_value_ << std::endl;
+
     for (unsigned int j=0; j<this->nrows_; j++)
     {
         for (unsigned int i=0; i<this->ncols_; i++)
-- 
GitLab