From 8cb325d506fb5b14fcf324be703c76de975c4983 Mon Sep 17 00:00:00 2001 From: feyeandal Date: Fri, 18 Mar 2022 09:28:49 +0800 Subject: [PATCH 1/3] add hazard pre and post-validator --- .DS_Store | Bin 0 -> 6148 bytes info.log | 38 ++++++++++++++++++++ src/.DS_Store | Bin 0 -> 6148 bytes src/haz_validator.py | 82 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 120 insertions(+) create mode 100644 .DS_Store create mode 100644 info.log create mode 100644 src/.DS_Store create mode 100644 src/haz_validator.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c5b09ad034e79bdda54e11cde79a391d09734040 GIT binary patch literal 6148 zcmeHKO;5r=5Pd6Xh#utVvA;mj=)qe<@L*zyk*G(70&1+3wDf?d{&e5Wu89QEoAF~N znR(OMncdDK-DLr|PB}UNngAM9!TL7M2O{I5E3y$Hn?$E`>?1{n``LVWzLISLW55{r zX$;7>+rT5HnDEPe_x+Z|Jm**seJoI5jxnCm!Zou}l=R1pw$R0ZV*`3ud>$j$=!D*a zI^et`+Eg<$B%yN38mYeFY&o8^`U00YqxZo47i!MRTg;dttBaS@PjuZv>so8xy%*kn zr7!01va;lSGqn-gIAPa^IHEm9TXwEr()rh&yz#KL)H6^cqdAgMk)*>cOSyHM{6_}D z58v4NkIh@p#(**KDFd=UL{z~zVC7M_4jR1z5bF%9(3iV})I+k=|MfPM2 z7z2Nb0ax$#yB)R^&eoOY^2i9q{s<@y KW{iPvW#AS0Kyab} literal 0 HcmV?d00001 diff --git a/info.log b/info.log new file mode 100644 index 0000000..8f5619d --- /dev/null +++ b/info.log @@ -0,0 +1,38 @@ +2022-03-01 17:12:45,922: reading test123 +2022-03-01 17:12:46,007: start dissolving for test123 +2022-03-01 17:12:46,057: done dissolving for test123 +2022-03-01 17:12:46,057: reading test11 +2022-03-01 17:12:46,085: no haz col found, skipping dissolving for test11 +2022-03-12 17:27:43,025: reading test123 +2022-03-12 17:27:43,102: no haz col found, skipping dissolving for test123 +2022-03-12 17:27:43,102: reading test11 +2022-03-12 17:27:43,127: no haz col found, skipping dissolving for test11 +2022-03-12 17:28:28,366: reading test123 +2022-03-12 17:28:28,442: start dissolving for test123 +2022-03-12 17:28:28,502: done dissolving for test123 +2022-03-12 17:28:28,502: reading test11 +2022-03-12 17:28:28,525: no haz col found, skipping dissolving for test11 +2022-03-12 17:30:25,265: reading test123 +2022-03-12 17:30:25,340: no haz col found, skipping dissolving for test123 +2022-03-12 17:30:25,340: no haz col found, skipping dissolving for test123 +2022-03-12 17:30:25,340: no haz col found, skipping dissolving for test123 +2022-03-12 17:30:25,340: no haz col found, skipping dissolving for test123 +2022-03-12 17:30:25,340: no haz col found, skipping dissolving for test123 +2022-03-12 17:30:25,340: start dissolving for test123 +2022-03-12 17:30:25,385: done dissolving for test123 +2022-03-12 17:30:25,385: reading test11 +2022-03-12 17:30:25,408: no haz col found, skipping dissolving for test11 +2022-03-12 17:30:25,408: no haz col found, skipping dissolving for test11 +2022-03-12 17:30:25,408: no haz col found, skipping dissolving for test11 +2022-03-12 17:30:25,408: no haz col found, skipping dissolving for test11 +2022-03-12 17:30:25,408: no haz col found, skipping dissolving for test11 +2022-03-12 17:30:25,408: no haz col found, skipping dissolving for test11 +2022-03-12 17:30:25,419: done dissolving for test11 +2022-03-16 10:52:54,898: reading test123 +2022-03-16 10:52:54,992: start dissolving for test123 +2022-03-16 10:52:55,036: done dissolving for test123 +2022-03-16 10:52:55,036: reading test11 +2022-03-16 10:52:55,058: no haz col found, skipping dissolving for test11 +2022-03-16 10:52:55,058: reading PH126300000_LH_LH3 +2022-03-16 10:53:19,595: start dissolving for PH126300000_LH_LH3 +2022-03-16 14:13:55,363: done dissolving for PH126300000_LH_LH3 diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 0: + geom_check.append(True) + else: + geom_check.append(False) + + validator = pd.DataFrame(data=zip(hazard_name, geom_check, attribute_check, prj_check, diss_check),columns=['hazard name', 'contains_geometry', 'correct_attribute', 'GCS_prj', 'diss_check']) + validator['rows'] = len(data.index) + + # Creates a new column indicating overall validation assessment for each shapefile. When it returns False, it means that the shapefile is invalid and needs to be returned to the hazard team for inspection. + validator['final_check'] = validator.contains_geometry & validator.correct_attribute & validator.GCS_prj & validator.diss_check + + # Saves the dataframe into a csv, with current datetime indicator + validator.to_csv(f'{datetimenow}_results_validation.csv', index=None, encoding="utf-8") + +if __name__ == '__main__': + # Path to directories + path_to_dir = os.path.dirname(os.path.abspath('__file__')) + input_path = os.path.join(path_to_dir, "input") + input_files = os.listdir(input_path) + + # Gets only the .shp + shp_files = [ file for file in input_files if file.endswith(".shp") ] + + # Extracts the hazard name (from the filename) + hazard_name = [ shp.replace(".shp", "") for shp in shp_files ] + + # Gets the current date and time + datetimenow = datetime.now().strftime("%Y%m%d %H:%M:%S") + + shapefile_validator() \ No newline at end of file From 7653e08d311a41d20fa31c6bcc895976daa3cf88 Mon Sep 17 00:00:00 2001 From: Feye Andal Date: Fri, 18 Mar 2022 09:29:31 +0800 Subject: [PATCH 2/3] Delete .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index c5b09ad034e79bdda54e11cde79a391d09734040..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKO;5r=5Pd6Xh#utVvA;mj=)qe<@L*zyk*G(70&1+3wDf?d{&e5Wu89QEoAF~N znR(OMncdDK-DLr|PB}UNngAM9!TL7M2O{I5E3y$Hn?$E`>?1{n``LVWzLISLW55{r zX$;7>+rT5HnDEPe_x+Z|Jm**seJoI5jxnCm!Zou}l=R1pw$R0ZV*`3ud>$j$=!D*a zI^et`+Eg<$B%yN38mYeFY&o8^`U00YqxZo47i!MRTg;dttBaS@PjuZv>so8xy%*kn zr7!01va;lSGqn-gIAPa^IHEm9TXwEr()rh&yz#KL)H6^cqdAgMk)*>cOSyHM{6_}D z58v4NkIh@p#(**KDFd=UL{z~zVC7M_4jR1z5bF%9(3iV})I+k=|MfPM2 z7z2Nb0ax$#yB)R^&eoOY^2i9q{s<@y KW{iPvW#AS0Kyab} From 0e6acc0c1eb3df466d688099aa56342bacce6c54 Mon Sep 17 00:00:00 2001 From: Feye Andal Date: Fri, 18 Mar 2022 09:29:45 +0800 Subject: [PATCH 3/3] Delete .DS_Store --- src/.DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/.DS_Store diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0