From d299022b1ebe29af981e4cf8a29d6fce784509c3 Mon Sep 17 00:00:00 2001 From: Shreyasvi Chandrasekhar Date: Tue, 11 Apr 2023 14:25:38 +0200 Subject: [PATCH 01/20] modified files to accommodate CND and UCF/USA merge --- .../ghm/data/gis/contacts_between_models.dbf | Bin 659 -> 623 bytes .../ghm/data/gis/contacts_between_models.shp | Bin 142464 -> 126288 bytes .../ghm/data/gis/contacts_between_models.shx | Bin 316 -> 300 bytes openquake/ghm/mosaic.py | 7 ++++--- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/openquake/ghm/data/gis/contacts_between_models.dbf b/openquake/ghm/data/gis/contacts_between_models.dbf index bae217fadb29b630090a5376a3f594ac4fd5b0f5..ab66aaa32deb9e2d79b289dfaccc5566a27da4fb 100644 GIT binary patch delta 75 zcmbQt`ksZAxtfJdaw2OqKd(Y)u%iM5IQzM5Z0TiW@^hIuQ+Bcelj!7pCKYK05I|Dp K>ly)7F9iUBUk`-< delta 100 zcmaFQGMSZ?xspp(dLnDI3YS8tvzr10__{_wSqh=Sj!>qvqu<8-UPdNIzsdg?jg$}) P2z^MZfksT$VA25qJo^P5aRo+}%@*Cuc^FwYKbUSV z!N|5*V#9StM)u7gHa=%!o+F2yLYeN6{rxe%k^c9q#6aiQ%t3mKO)GYW5i zvV<|6kx^v3&oV}JUPjUFC7T(y3o?pr*Ez}GX8Iz%Eh>Svk22$J^<5X BPQ(BJ delta 16536 zcmYk^c_38nA3uCUwAo9M>`IF^X(8#F8A3`(QOyjpM3$_f#gv40x+%(<7D`kqmF=`4 zTO?a$DNCYkDTVmGPtW)FJdc0wUY|L0<}BCsxwdoes`rzRHcp9@6JpFFQFF}}3&aWu z2nYn#hc2o$;!-NpQqPAN5Q0#$a3+Vsf9-zlCWL{1NapNpVoYN&1n;@*RbdEaSE=kZ zVob_j>sqYL5WauvrYJ)sJMH2cS;pk-*35baV@mepyI%wuQ?rw^XDc(NWk0S7n9i7< zy}V_z2tzb`ZO3dqhFFfd3gf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cbfy@VS=s+@-VUalgf2Uj3FYtnqu9a2=KT-a;6GdJuZO^Yr3dQ%*b*|f=u@RB z@&yW85q(0eB zLLg-O&q3O`3p*Z4^H42k+&gapA3yL%p0>xDPidC0aMS#mw3~Mv^jM8l`g}!M;v~2v zDb3vm*1hu~`4<<3Fm%si7x;76q9!h^^fbA^3HJ9L$XO5bzeIge+KYgt3gZMF$m+Fm z{||1~t5sP8rwYF6_zAx~Kl|G*m|6R}a2U=owvF8lzmDHANSk}E;1=yyJ=|eB_iviB zY?TjOl;-yR2wbXtnR5p2e7sH925rgqZ4pHUT(tit?@#9ML?Fa?NU0DT=szmSOrjf` zWj{8)fqzM!?NvtWwbE^&@^|%=HzUC$1s}0 MkiQiDkrDlW04GD*djJ3c diff --git a/openquake/ghm/data/gis/contacts_between_models.shx b/openquake/ghm/data/gis/contacts_between_models.shx index 2000423891fc2fcfc9db09f82c44e1fbf791e6b1..d3a198ac8e4cf2cfa0666d00855640398f9e4e1f 100644 GIT binary patch delta 207 zcmW-bEocG(9L0ZkPPu_&he=RmpuxCcFsx}11Q{!SBQCYyEf1TmOQCc}X+42Gdq zWXgitEJF;J7EI#9@c+NZ`+zq$C#DlI2EAyZYrA0oL0p&`idP|fg}^)HKOh)}Vgooq zsRBj|%4_8;s2#vRgXREyinP^_Nq5HZyns<1Lf>5l+$^A>GlnIQ7W_m delta 223 zcmXAjzl*_f9L8TCzv<*CrB0|bm~}3*Qc6iNTqd*WTS_){e*tBXq;5ATC4)hi5s8KM zCf#6?*;A(H{eC~s^XfgZEp6R5Gwwx89R|P-UZ)WJhIeV^Q+plqLvWR$c!ie;eEF2U zNbg`Qs5O-HK%)iD1z2gYE7DXyrh6|3fnWI199qF_BVY6U1pYRxt5oo2VcUHg`;owV oI0()Zj!8Wr?<}}SrN6#31^ Date: Thu, 13 Apr 2023 18:39:23 +0200 Subject: [PATCH 02/20] added south sudan and modified py script --- openquake/ghm/create_homogenised_curves.py | 2 +- openquake/ghm/mosaic.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openquake/ghm/create_homogenised_curves.py b/openquake/ghm/create_homogenised_curves.py index 567093eec..97d2d6403 100755 --- a/openquake/ghm/create_homogenised_curves.py +++ b/openquake/ghm/create_homogenised_curves.py @@ -296,7 +296,7 @@ def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, # TODO can we remove this now? if key in ['waf', 'ssa']: from shapely.geometry import Polygon - coo = get_poly_from_str(mosaic.SUBSETS[key]['AO'][0]) + coo = get_poly_from_str(mosaic.SUBSETS['GID_0'][key]['AGO'][0]) df = pd.DataFrame({'name': ['tmp'], 'geo': [Polygon(coo)]}) dft = gpd.GeoDataFrame(df, geometry='geo') idx = map_gdf.geometry.intersects(dft.geometry[0]) diff --git a/openquake/ghm/mosaic.py b/openquake/ghm/mosaic.py index 0461d63d1..59ae774f1 100644 --- a/openquake/ghm/mosaic.py +++ b/openquake/ghm/mosaic.py @@ -52,6 +52,7 @@ 'SDN': ['-21 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20 25 20 30 20 39 20 39 39 -21 39']}, 'sea': {'MYS': ['98 0 106 0 106 8 98 8']}, 'ssa': {'SDN': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 60 -28.5 60 20 40 20 35 20 30 20'], + 'SSD': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 60 -28.5 60 20 40 20 35 20 30 20'], 'CAF': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 60 -28.5 60 20 40 20 35 20 30 20'], 'AGO': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 60 -28.5 60 20 40 20 35 20 30 20'], 'COG': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 60 -28.5 60 20 40 20 35 20 30 20'], @@ -70,6 +71,7 @@ 'NER': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 9 -31 -29 20 -20 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20'], 'ZAF': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 9 -31 -29 20 -20 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20'], 'SDN': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 9 -31 -29 20 -20 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20'], + 'SSD': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 9 -31 -29 20 -20 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20'], 'NAM': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 9 -31 -29 20 -20 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20']} }, 'FIPS_CNTRY' : { 'als': {'US': ['-180 50 -127 50 -127 73 -180 73', @@ -175,8 +177,8 @@ 'ssa': ['AGO', 'BDI', 'BWA', 'CAF', 'COD', 'COG', 'COM', 'DJI', 'ERI', 'ETH', 'KEN', 'MDG', 'MOZ', 'MWI', 'NAM', - 'RWA', 'SDN', 'SOM', 'TZA', 'UGA', - 'ZMB', 'ZWE'], + 'RWA', 'SDN', 'SOM', 'SSD', 'TZA', + 'UGA', 'ZMB', 'ZWE'], 'twn': ['TWN'], 'usa': ['USA', 'CAL'], # 'ucf': ['CAL'], ## UCF merged with USA @@ -185,7 +187,8 @@ 'GAB', 'GHA', 'GIN', 'GMB', 'GNB', 'GNQ', 'LBR', 'LBY', 'MLI', 'MRT', 'NAM', 'NER', 'NGA', 'SDN', 'SEN', - 'SHN', 'SLE', 'STP', 'TCD', 'TGO'], + 'SHN', 'SLE', 'SSD', 'STP', 'TCD', + 'TGO'], 'zaf': ['LSO', 'SWZ', 'ZAF'], }, 'FIPS_CNTRY': { 'als': ['US'], From 02f6dfc58d0b5f564c74f0b8ee2251239971f2ea Mon Sep 17 00:00:00 2001 From: Shreyasvi Date: Thu, 13 Apr 2023 22:15:08 +0530 Subject: [PATCH 03/20] added south sudan and modified py script --- openquake/ghm/create_homogenised_curves.py | 2 +- openquake/ghm/mosaic.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openquake/ghm/create_homogenised_curves.py b/openquake/ghm/create_homogenised_curves.py index 567093eec..97d2d6403 100755 --- a/openquake/ghm/create_homogenised_curves.py +++ b/openquake/ghm/create_homogenised_curves.py @@ -296,7 +296,7 @@ def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, # TODO can we remove this now? if key in ['waf', 'ssa']: from shapely.geometry import Polygon - coo = get_poly_from_str(mosaic.SUBSETS[key]['AO'][0]) + coo = get_poly_from_str(mosaic.SUBSETS['GID_0'][key]['AGO'][0]) df = pd.DataFrame({'name': ['tmp'], 'geo': [Polygon(coo)]}) dft = gpd.GeoDataFrame(df, geometry='geo') idx = map_gdf.geometry.intersects(dft.geometry[0]) diff --git a/openquake/ghm/mosaic.py b/openquake/ghm/mosaic.py index 0461d63d1..59ae774f1 100644 --- a/openquake/ghm/mosaic.py +++ b/openquake/ghm/mosaic.py @@ -52,6 +52,7 @@ 'SDN': ['-21 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20 25 20 30 20 39 20 39 39 -21 39']}, 'sea': {'MYS': ['98 0 106 0 106 8 98 8']}, 'ssa': {'SDN': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 60 -28.5 60 20 40 20 35 20 30 20'], + 'SSD': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 60 -28.5 60 20 40 20 35 20 30 20'], 'CAF': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 60 -28.5 60 20 40 20 35 20 30 20'], 'AGO': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 60 -28.5 60 20 40 20 35 20 30 20'], 'COG': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 60 -28.5 60 20 40 20 35 20 30 20'], @@ -70,6 +71,7 @@ 'NER': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 9 -31 -29 20 -20 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20'], 'ZAF': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 9 -31 -29 20 -20 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20'], 'SDN': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 9 -31 -29 20 -20 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20'], + 'SSD': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 9 -31 -29 20 -20 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20'], 'NAM': ['25 20 25 5 18 -5.5 18.50 -9.80 18.95 -14.17 20.6 -30.25 9 -31 -29 20 -20 20 -15 20 -10 20 -5 20 0 20 5 20 10 20 15 20 20 20']} }, 'FIPS_CNTRY' : { 'als': {'US': ['-180 50 -127 50 -127 73 -180 73', @@ -175,8 +177,8 @@ 'ssa': ['AGO', 'BDI', 'BWA', 'CAF', 'COD', 'COG', 'COM', 'DJI', 'ERI', 'ETH', 'KEN', 'MDG', 'MOZ', 'MWI', 'NAM', - 'RWA', 'SDN', 'SOM', 'TZA', 'UGA', - 'ZMB', 'ZWE'], + 'RWA', 'SDN', 'SOM', 'SSD', 'TZA', + 'UGA', 'ZMB', 'ZWE'], 'twn': ['TWN'], 'usa': ['USA', 'CAL'], # 'ucf': ['CAL'], ## UCF merged with USA @@ -185,7 +187,8 @@ 'GAB', 'GHA', 'GIN', 'GMB', 'GNB', 'GNQ', 'LBR', 'LBY', 'MLI', 'MRT', 'NAM', 'NER', 'NGA', 'SDN', 'SEN', - 'SHN', 'SLE', 'STP', 'TCD', 'TGO'], + 'SHN', 'SLE', 'SSD', 'STP', 'TCD', + 'TGO'], 'zaf': ['LSO', 'SWZ', 'ZAF'], }, 'FIPS_CNTRY': { 'als': ['US'], From cfa89913a821dae9d344f0380c07cdbfbf203816 Mon Sep 17 00:00:00 2001 From: Hazard Team Date: Fri, 14 Apr 2023 20:32:14 +0200 Subject: [PATCH 04/20] modified the scripts ofr vs30 calc --- openquake/ghm/bin/create_curves.sh | 6 ++-- openquake/ghm/create_homogenised_curves.py | 38 ++++++++++++++++------ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/openquake/ghm/bin/create_curves.sh b/openquake/ghm/bin/create_curves.sh index 52a58287a..c936c175f 100755 --- a/openquake/ghm/bin/create_curves.sh +++ b/openquake/ghm/bin/create_curves.sh @@ -31,13 +31,15 @@ IMTSTR='PGA' I_SHP='./../data/gis/inland.shp' # BUF=50.0 +#flag set to 1 for vs30 calc +VS30_FLAG=1 # # List of models to be processed. This is an optional parameter. If not set, # i.e. MDLS="", all the models specified in `openquake.ghm.mosaic.DATA` # will be used. #MDLS="-m als,arb,aus,cca,cea,chn,eur,gld,haw,idn,ind,jpn,kor,mex,mie,naf,nea,nwa,nzl,pac,phl,png,sam,sea,ssa,twn,waf,zaf" #MDLS="-m usa,cnd" -#MDLS="-m cca,sam" +#MDLS="-m waf,ssa" # # Run hazard curves homogenisation -../create_homogenised_curves.py $C_SHP $O_PATH $D_PATH $SIDX $B_SHP $IMTSTR $I_SHP $BUF $MDLS +../create_homogenised_curves.py $C_SHP $O_PATH $D_PATH $SIDX $B_SHP $IMTSTR $I_SHP $BUF $MDLS $VS30_FLAG diff --git a/openquake/ghm/create_homogenised_curves.py b/openquake/ghm/create_homogenised_curves.py index 97d2d6403..43dd4680e 100755 --- a/openquake/ghm/create_homogenised_curves.py +++ b/openquake/ghm/create_homogenised_curves.py @@ -65,28 +65,46 @@ def get_poly_from_str(tstr): return coo -def find_hazard_curve_file(datafolder, key, imt_str): +def find_hazard_curve_file(datafolder, vs30_flag, key, imt_str): """ Searches for a file in a folder given a key :param str datafolder: The name of the folder where to search + :param str key: The pattern to be used for searching the file - :param imt_str: + + :param str imt_str: String specifying the desired intensity measure type + + :param bool vs30_flag: + Flag to determine whether to search for files with vs30 in the folder path. + :return: A list with the files matching the pattern """ # First search for mean results tmps = 'hazard_curve-mean-{:s}*.csv'.format(imt_str) key = re.sub('[0-9]', '', key) - data_path = os.path.join(datafolder, key.upper(), 'out*', tmps) + + if float(vs30_flag)==1: + data_path = os.path.join(datafolder, key.upper(), 'out/vs30*', tmps) + else: + data_path = os.path.join(datafolder, key.upper(), 'out*', tmps) + data_fname = glob.glob(data_path) + if len(data_fname) == 0: tmps = 'hazard_curve-rlz-*-{:s}*.csv'.format(imt_str) - data_path = os.path.join(datafolder, key.upper(), 'out*', tmps) + + if float(vs30_flag)==1: + data_path = os.path.join(datafolder, key.upper(), 'out/vs30*', tmps) + else: + data_path = os.path.join(datafolder, key.upper(), 'out*', tmps) + data_fname = glob.glob(data_path) + return data_fname @@ -190,7 +208,7 @@ def get_imtls(poes): def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, imt_str, inland_shp, models_list=None, only_buffers=False, - buf=50, h3_resolution=6, mosaic_key='GID_0'): + buf=50, h3_resolution=6, mosaic_key='GID_0',vs30_flag=False,): """ This function processes all the models listed in the mosaic.DATA dictionary. The code creates for the models in contact with other models @@ -258,13 +276,12 @@ def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, buffer_data = {} buffer_poes = {} coords = {} - # Skip models not included in the list if re.sub('[0-9]+', '', key) not in models_list: continue # Find name of the file with hazard curves print_model_info(i, key) - data_fname = find_hazard_curve_file(datafolder, key, imt_str) + data_fname = find_hazard_curve_file(datafolder, vs30_flag, key, imt_str) # Read hazard curves map_gdf, header = get_hcurves_geodataframe(data_fname[0]) @@ -630,9 +647,8 @@ def buffer_processing(outpath, imt_str, models_list, poelabs, buf): fou.close() fuu.close() - def process(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, - imt_str, inland_shp, buf, *, models_list=None, only_buffers=False, + imt_str, inland_shp, buf,vs30_flag, *, models_list=None, only_buffers=False, h3_resolution=6, mosaic_key='GID_0'): """ This function processes all the models listed in the mosaic.DATA dictionary @@ -640,7 +656,7 @@ def process(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, """ proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, imt_str, inland_shp, models_list, only_buffers, buf, h3_resolution, - mosaic_key) + mosaic_key, vs30_flag) process.contacts_shp = 'Name of shapefile with contacts' @@ -651,9 +667,11 @@ def process(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, process.imt_str = 'String with the intensity measure type' process.inland_shp = 'Name of shapefile with inland territories' process.buf = 'Buffer distance' +process.vs30_flag = 'Boolean flag to set path for reading hazard curves' process.models_list = 'List of models to be processed' process.h3_resolution = 'H3 resolution used to create the grid of sites' process.mosaic_key = 'The key used to specify countries' if __name__ == "__main__": sap.run(process) + From 2807a3f8535a098dd5c98ce93a65faea4f051a99 Mon Sep 17 00:00:00 2001 From: Shreyasvi Date: Sat, 15 Apr 2023 00:05:34 +0530 Subject: [PATCH 05/20] modified the scripts ofr vs30 calc --- openquake/ghm/bin/create_curves.sh | 8 +++-- openquake/ghm/create_homogenised_curves.py | 38 ++++++++++++++++------ 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/openquake/ghm/bin/create_curves.sh b/openquake/ghm/bin/create_curves.sh index 52a58287a..07ab4eafa 100755 --- a/openquake/ghm/bin/create_curves.sh +++ b/openquake/ghm/bin/create_curves.sh @@ -25,19 +25,21 @@ B_SHP='~/gem-hazard-data/gis/grid/gadm_410_level_0.gpkg' #B_SHP='./../data/gis/world_country_admin_boundary_with_fips_codes_mosaic_eu_russia.shp' # # String with the intensity measure type -IMTSTR='PGA' +IMTSTR='SA(1.0)' # # Shapefile with inland territories I_SHP='./../data/gis/inland.shp' # BUF=50.0 +#flag set to 1 for vs30 calc +VS30_FLAG=1 # # List of models to be processed. This is an optional parameter. If not set, # i.e. MDLS="", all the models specified in `openquake.ghm.mosaic.DATA` # will be used. #MDLS="-m als,arb,aus,cca,cea,chn,eur,gld,haw,idn,ind,jpn,kor,mex,mie,naf,nea,nwa,nzl,pac,phl,png,sam,sea,ssa,twn,waf,zaf" #MDLS="-m usa,cnd" -#MDLS="-m cca,sam" +#MDLS="-m waf,ssa" # # Run hazard curves homogenisation -../create_homogenised_curves.py $C_SHP $O_PATH $D_PATH $SIDX $B_SHP $IMTSTR $I_SHP $BUF $MDLS +../create_homogenised_curves.py $C_SHP $O_PATH $D_PATH $SIDX $B_SHP $IMTSTR $I_SHP $BUF $MDLS $VS30_FLAG diff --git a/openquake/ghm/create_homogenised_curves.py b/openquake/ghm/create_homogenised_curves.py index 97d2d6403..43dd4680e 100755 --- a/openquake/ghm/create_homogenised_curves.py +++ b/openquake/ghm/create_homogenised_curves.py @@ -65,28 +65,46 @@ def get_poly_from_str(tstr): return coo -def find_hazard_curve_file(datafolder, key, imt_str): +def find_hazard_curve_file(datafolder, vs30_flag, key, imt_str): """ Searches for a file in a folder given a key :param str datafolder: The name of the folder where to search + :param str key: The pattern to be used for searching the file - :param imt_str: + + :param str imt_str: String specifying the desired intensity measure type + + :param bool vs30_flag: + Flag to determine whether to search for files with vs30 in the folder path. + :return: A list with the files matching the pattern """ # First search for mean results tmps = 'hazard_curve-mean-{:s}*.csv'.format(imt_str) key = re.sub('[0-9]', '', key) - data_path = os.path.join(datafolder, key.upper(), 'out*', tmps) + + if float(vs30_flag)==1: + data_path = os.path.join(datafolder, key.upper(), 'out/vs30*', tmps) + else: + data_path = os.path.join(datafolder, key.upper(), 'out*', tmps) + data_fname = glob.glob(data_path) + if len(data_fname) == 0: tmps = 'hazard_curve-rlz-*-{:s}*.csv'.format(imt_str) - data_path = os.path.join(datafolder, key.upper(), 'out*', tmps) + + if float(vs30_flag)==1: + data_path = os.path.join(datafolder, key.upper(), 'out/vs30*', tmps) + else: + data_path = os.path.join(datafolder, key.upper(), 'out*', tmps) + data_fname = glob.glob(data_path) + return data_fname @@ -190,7 +208,7 @@ def get_imtls(poes): def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, imt_str, inland_shp, models_list=None, only_buffers=False, - buf=50, h3_resolution=6, mosaic_key='GID_0'): + buf=50, h3_resolution=6, mosaic_key='GID_0',vs30_flag=False,): """ This function processes all the models listed in the mosaic.DATA dictionary. The code creates for the models in contact with other models @@ -258,13 +276,12 @@ def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, buffer_data = {} buffer_poes = {} coords = {} - # Skip models not included in the list if re.sub('[0-9]+', '', key) not in models_list: continue # Find name of the file with hazard curves print_model_info(i, key) - data_fname = find_hazard_curve_file(datafolder, key, imt_str) + data_fname = find_hazard_curve_file(datafolder, vs30_flag, key, imt_str) # Read hazard curves map_gdf, header = get_hcurves_geodataframe(data_fname[0]) @@ -630,9 +647,8 @@ def buffer_processing(outpath, imt_str, models_list, poelabs, buf): fou.close() fuu.close() - def process(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, - imt_str, inland_shp, buf, *, models_list=None, only_buffers=False, + imt_str, inland_shp, buf,vs30_flag, *, models_list=None, only_buffers=False, h3_resolution=6, mosaic_key='GID_0'): """ This function processes all the models listed in the mosaic.DATA dictionary @@ -640,7 +656,7 @@ def process(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, """ proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, imt_str, inland_shp, models_list, only_buffers, buf, h3_resolution, - mosaic_key) + mosaic_key, vs30_flag) process.contacts_shp = 'Name of shapefile with contacts' @@ -651,9 +667,11 @@ def process(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, process.imt_str = 'String with the intensity measure type' process.inland_shp = 'Name of shapefile with inland territories' process.buf = 'Buffer distance' +process.vs30_flag = 'Boolean flag to set path for reading hazard curves' process.models_list = 'List of models to be processed' process.h3_resolution = 'H3 resolution used to create the grid of sites' process.mosaic_key = 'The key used to specify countries' if __name__ == "__main__": sap.run(process) + From ebabd7975d91eabfd1d7cf1152715e802cced3fb Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Tue, 9 May 2023 19:35:49 +0200 Subject: [PATCH 06/20] updating to run in a loop for all maps --- openquake/ghm/bin/create_curves.sh | 57 +++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/openquake/ghm/bin/create_curves.sh b/openquake/ghm/bin/create_curves.sh index 07ab4eafa..281509d2e 100755 --- a/openquake/ghm/bin/create_curves.sh +++ b/openquake/ghm/bin/create_curves.sh @@ -9,37 +9,68 @@ # Create the homogenised set of hazard curves C_SHP='./../data/gis/contacts_between_models.shp' # -# Output folder -O_PATH='/tmp/ghm' + # # Path to the folder with the mosaic repository # For the original hazard map we used this folder: # /Users/mpagani/Documents/2018/diary/11/13_ucf/maps -D_PATH=$REPOS'/mosaic' +#D_PATH=$REPOS'/mosaic' +D_PATH=$GEM_MOSAIC # # Spatial index folder -SIDX=$GEMDATA'/trigrd_split_9_spacing_13' +SIDX='../GGrid/trigrd_split_9_spacing_13' # # Boundaries shapefilei -B_SHP='~/gem-hazard-data/gis/grid/gadm_410_level_0.gpkg' +# $GEM_DATA is the path to gem-hazard-data +B_SHP=$GEM_DATA'gis/grid/gadm_410_level_0.gpkg' + +# Former shapefile used before v2023 #B_SHP='./../data/gis/world_country_admin_boundary_with_fips_codes_mosaic_eu_russia.shp' # -# String with the intensity measure type -IMTSTR='SA(1.0)' # # Shapefile with inland territories I_SHP='./../data/gis/inland.shp' # BUF=50.0 -#flag set to 1 for vs30 calc -VS30_FLAG=1 # # List of models to be processed. This is an optional parameter. If not set, # i.e. MDLS="", all the models specified in `openquake.ghm.mosaic.DATA` # will be used. #MDLS="-m als,arb,aus,cca,cea,chn,eur,gld,haw,idn,ind,jpn,kor,mex,mie,naf,nea,nwa,nzl,pac,phl,png,sam,sea,ssa,twn,waf,zaf" #MDLS="-m usa,cnd" -#MDLS="-m waf,ssa" -# -# Run hazard curves homogenisation -../create_homogenised_curves.py $C_SHP $O_PATH $D_PATH $SIDX $B_SHP $IMTSTR $I_SHP $BUF $MDLS $VS30_FLAG +MDLS="-m waf,ssa" + +# path to where the maps are stored +O_PATH_MAP='/tmp/ghm/global' +PREFIX='map' +# String with the intensity measure type +for IMTSTR in 'PGA' 'SA(0.2)' 'SA(0.3)' 'SA(0.6)' 'SA(1.0)' 'SA(2.0)' +do + #flag set to 1 for vs30 calc or 0 for rock + for VS30_FLAG in 0 1 + do + + # Output path for hazard curves + if (($VS30_FLAG == 1 )) + then + SITECOND='vs30' + else + SITECOND='rock' + fi + + O_PATH='/tmp/ghm/'$IMTSTR'-'$SITECOND + + # Run hazard curves homogenisation + ../create_homogenised_curves.py $C_SHP $O_PATH $D_PATH $SIDX $B_SHP $IMTSTR $I_SHP $BUF $MDLS $VS30_FLAG + + # loop through probabilities of exceedance + for PEX in '0.002105' '0.000404' + do + # file name for final map + O_NAME='v2023-1-'$IMTSTR'-'$SITECOND'-'$PEX'.csv' + ../create_map_from_curves.py $O_PATH $PREFIX $O_NAME $O_PATH_MAP $IMTSTR $PEX + + done + done + +done From 5b56d5996aad8b7e620a59750ce724afcb65673e Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Tue, 9 May 2023 19:36:22 +0200 Subject: [PATCH 07/20] updating to run in a loop for all maps --- openquake/ghm/create_homogenised_curves.py | 2 ++ openquake/ghm/create_map_from_curves.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/openquake/ghm/create_homogenised_curves.py b/openquake/ghm/create_homogenised_curves.py index 43dd4680e..1e941bcc6 100755 --- a/openquake/ghm/create_homogenised_curves.py +++ b/openquake/ghm/create_homogenised_curves.py @@ -492,6 +492,8 @@ def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, if not os.path.exists(tmpdir): os.mkdir(tmpdir) + print('saving everything to {}'.format(tmpdir)) + # Save data fname = os.path.join(tmpdir, f'{key:s}_data.pkl') fou = open(fname, "wb") diff --git a/openquake/ghm/create_map_from_curves.py b/openquake/ghm/create_map_from_curves.py index 126f81b5c..b0603d128 100755 --- a/openquake/ghm/create_map_from_curves.py +++ b/openquake/ghm/create_map_from_curves.py @@ -42,7 +42,7 @@ def read_hazard_curve_files(path_in, prefix=''): :param prefix: Prefix of the files in `path_in` """ - data_path = os.path.join(path_in, '{:s}*'.format(prefix)) + data_path = os.path.join(path_in, '{:s}*json'.format(prefix)) lons = [] lats = [] From 6a1c351d2d9ff62fa6fe6cc94802648a2a087e36 Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Fri, 19 May 2023 17:16:56 +0200 Subject: [PATCH 08/20] adding the missing coverage --- openquake/ghm/mosaic.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openquake/ghm/mosaic.py b/openquake/ghm/mosaic.py index 59ae774f1..2cc5b92b2 100644 --- a/openquake/ghm/mosaic.py +++ b/openquake/ghm/mosaic.py @@ -33,6 +33,7 @@ 'als': {'USA': ['-180 50 -127 50 -127 73 -180 73', '170 47 180 47 180 57 170 57']}, 'cca': {'COL': ['-83 11 -80 11 -80 14 -83 14']}, + 'eur': {'RUS': ['25 50 25 60 16 60 16 50']} 'haw': {'USA': ['-162 18 -153 18 -153 24 -162 24']}, 'idn': {'MYS': ['108 0 120 0 120 9 108 9']}, 'nea': {'RUS': ['75 0 180 0 180 88 75 88', @@ -147,12 +148,13 @@ 'IMN', 'IRL', 'ISL', 'ITA', 'JEY', 'LIE', 'LTU', 'LUX', 'LVA', 'MCO', 'MDA', 'MKD', 'MLT', 'MNE', 'NLD', - 'NOR', 'POL', 'PRT', 'ROU', 'RUX', - 'SRB', 'SVK', 'SVN', 'SWE', 'UKR'], + 'NOR', 'POL', 'PRT', 'ROU', 'RUS', + 'SRB', 'SVK', 'SVN', 'SWE', 'UKR', + 'XKO', 'ZNC', 'ALA'], 'haw': ['USA'], 'ind': ['BGD', 'BTN', 'IND', 'Z01', 'Z04', 'Z05', 'Z07', 'Z09', 'LKA', 'NPL'], - 'idn': ['BRN', 'IDN', 'MXW', 'TLS'], + 'idn': ['BRN', 'IDN', 'MXW', 'TLS', 'MYS'], 'jpn': ['JPN'], 'kor': ['KOR', 'PRK'], 'mex': ['MEX'], From 36fc29e7faaeec9b92ffec38be9ca29f6824730d Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Fri, 19 May 2023 17:27:28 +0200 Subject: [PATCH 09/20] correction --- openquake/ghm/mosaic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openquake/ghm/mosaic.py b/openquake/ghm/mosaic.py index 2cc5b92b2..0f86ea3c5 100644 --- a/openquake/ghm/mosaic.py +++ b/openquake/ghm/mosaic.py @@ -33,7 +33,7 @@ 'als': {'USA': ['-180 50 -127 50 -127 73 -180 73', '170 47 180 47 180 57 170 57']}, 'cca': {'COL': ['-83 11 -80 11 -80 14 -83 14']}, - 'eur': {'RUS': ['25 50 25 60 16 60 16 50']} + 'eur': {'RUS': ['25 50 25 60 16 60 16 50']}, 'haw': {'USA': ['-162 18 -153 18 -153 24 -162 24']}, 'idn': {'MYS': ['108 0 120 0 120 9 108 9']}, 'nea': {'RUS': ['75 0 180 0 180 88 75 88', From d38706d2f76a253da94a39e8978510734accdd10 Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Sat, 20 May 2023 12:35:41 +0200 Subject: [PATCH 10/20] fixing country codes --- openquake/ghm/mosaic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openquake/ghm/mosaic.py b/openquake/ghm/mosaic.py index 0f86ea3c5..3e8fdb042 100644 --- a/openquake/ghm/mosaic.py +++ b/openquake/ghm/mosaic.py @@ -140,7 +140,7 @@ 'mie': ['AFG', 'ARM', 'AZE', 'CYP', 'GEO', 'IRN', 'IRQ', 'ISR', 'JOR', 'KWT', 'LBN', 'PAK', 'Z06', 'PSA', 'PSE', - 'SYR', 'TUR'], + 'SYR', 'TUR', 'ZNC'], 'eur': ['ALB', 'AND', 'AUT', 'BEL', 'BGR', 'BIH', 'BLR', 'CHE', 'CZE', 'DEU', 'DNK', 'ESP', 'EST', 'FIN', 'FRA', @@ -150,7 +150,7 @@ 'MDA', 'MKD', 'MLT', 'MNE', 'NLD', 'NOR', 'POL', 'PRT', 'ROU', 'RUS', 'SRB', 'SVK', 'SVN', 'SWE', 'UKR', - 'XKO', 'ZNC', 'ALA'], + 'XKO', 'ALA'], 'haw': ['USA'], 'ind': ['BGD', 'BTN', 'IND', 'Z01', 'Z04', 'Z05', 'Z07', 'Z09', 'LKA', 'NPL'], From a82628f9377a1c4905eaad43d523e8faca9581ba Mon Sep 17 00:00:00 2001 From: Hazard Team Date: Sat, 20 May 2023 14:37:56 +0200 Subject: [PATCH 11/20] adding mosaic countries --- openquake/ghm/mosaic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openquake/ghm/mosaic.py b/openquake/ghm/mosaic.py index 3e8fdb042..8f372b078 100644 --- a/openquake/ghm/mosaic.py +++ b/openquake/ghm/mosaic.py @@ -150,7 +150,7 @@ 'MDA', 'MKD', 'MLT', 'MNE', 'NLD', 'NOR', 'POL', 'PRT', 'ROU', 'RUS', 'SRB', 'SVK', 'SVN', 'SWE', 'UKR', - 'XKO', 'ALA'], + 'XKO', 'ALA', 'GGY'], 'haw': ['USA'], 'ind': ['BGD', 'BTN', 'IND', 'Z01', 'Z04', 'Z05', 'Z07', 'Z09', 'LKA', 'NPL'], From b5bd1dedfb0b20c89b9584695a430a0a4dd3e348 Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Sat, 20 May 2023 15:48:23 +0200 Subject: [PATCH 12/20] add bes --- openquake/ghm/mosaic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openquake/ghm/mosaic.py b/openquake/ghm/mosaic.py index 8f372b078..724d41488 100644 --- a/openquake/ghm/mosaic.py +++ b/openquake/ghm/mosaic.py @@ -154,7 +154,7 @@ 'haw': ['USA'], 'ind': ['BGD', 'BTN', 'IND', 'Z01', 'Z04', 'Z05', 'Z07', 'Z09', 'LKA', 'NPL'], - 'idn': ['BRN', 'IDN', 'MXW', 'TLS', 'MYS'], + 'idn': ['BRN', 'IDN', 'TLS', 'MYS'], 'jpn': ['JPN'], 'kor': ['KOR', 'PRK'], 'mex': ['MEX'], @@ -173,7 +173,7 @@ 'sam': ['ABW', 'ARG', 'BOL', 'BRA', 'CHL', 'COL', 'CUW', 'ECU', 'FLK', 'GUF', 'GUY', 'PER', 'PRY', 'SUR', 'URY', - 'VEN'], + 'VEN', 'BES'], 'sea': ['KHM', 'LAO', 'MMR', 'MYS', 'SGP', 'THA', 'VNM'], 'ssa': ['AGO', 'BDI', 'BWA', 'CAF', 'COD', From 541ca2da16a5ab405af8f7e914d271e10f3caac6 Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Mon, 22 May 2023 11:10:08 +0200 Subject: [PATCH 13/20] adding turkey + cyprus to eur list --- openquake/ghm/mosaic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openquake/ghm/mosaic.py b/openquake/ghm/mosaic.py index 724d41488..c42752cb1 100644 --- a/openquake/ghm/mosaic.py +++ b/openquake/ghm/mosaic.py @@ -150,7 +150,8 @@ 'MDA', 'MKD', 'MLT', 'MNE', 'NLD', 'NOR', 'POL', 'PRT', 'ROU', 'RUS', 'SRB', 'SVK', 'SVN', 'SWE', 'UKR', - 'XKO', 'ALA', 'GGY'], + 'XKO', 'ALA', 'GGY', 'TUR', 'CYP', + 'ZNC'], 'haw': ['USA'], 'ind': ['BGD', 'BTN', 'IND', 'Z01', 'Z04', 'Z05', 'Z07', 'Z09', 'LKA', 'NPL'], From b60270f095de47931a0dad4796239f6e1063279f Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Wed, 24 May 2023 09:10:18 +0200 Subject: [PATCH 14/20] fixing index issue that affects NWA --- openquake/ghm/grid/get_sites.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openquake/ghm/grid/get_sites.py b/openquake/ghm/grid/get_sites.py index 9781f7bad..32647b99d 100644 --- a/openquake/ghm/grid/get_sites.py +++ b/openquake/ghm/grid/get_sites.py @@ -219,8 +219,8 @@ def _get_sites(model, folder_out, conf, root_path=''): feature_coll = gpd.GeoSeries([tpoly]).__geo_interface__ tmp = feature_coll['features'][0]['geometry'] tidx_b = h3.polyfill_geojson(tmp, h3_resolution) - tidx_a = list(set(tidx_a) & set(tidx_b)) - sites_indices.extend(tidx_a) + tidx_c = list(set(tidx_a) & set(tidx_b)) + sites_indices.extend(tidx_c) else: sites_indices.extend(tidx_a) From 9f792a02bd6b2aef950f8c40bca061c30aae62de Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Thu, 1 Jun 2023 15:35:56 +0200 Subject: [PATCH 15/20] updates to map script --- openquake/ghm/gmt/plot_map.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/openquake/ghm/gmt/plot_map.sh b/openquake/ghm/gmt/plot_map.sh index 499e05a9c..802b61924 100755 --- a/openquake/ghm/gmt/plot_map.sh +++ b/openquake/ghm/gmt/plot_map.sh @@ -25,7 +25,8 @@ delete_temporary_folders() do DIRECTORY=$ROOT$i if [ -d "$DIRECTORY" ]; then - rm -rf $DIRECTORY + echo "Not erasing anything" + # rm -rf $DIRECTORY fi done } @@ -63,10 +64,12 @@ plot() # Input cpt CPTT2="./cpt/gm.cpt" + CPTT2="./cpt/gm_new.cpt" # Input topography - GTOPO=$DATA"/gem/gmt/globalGTOPO30.grd" + #GTOPO=$DATA"/gem/gmt/globalGTOPO30.grd" + GTOPO=$DATA"/dem/ETOPO1_Ice_g_gmt4.grd" # Input bathymetry - bat_grd=$DATA"/gem/gmt/ETOPO1_Ice_g_gmt4.grd" + bat_grd=$DATA"/dem/ETOPO1_Ice_g_gmt4.grd" PS=$ROOT"/fig/out.ps" PNG=$ROOT"/fig/out.png" @@ -129,9 +132,10 @@ plot() gmt grdimage $GRDB -R$EXTE $PRO -I$bat_shadow -C$CPTT2 -O -K -nb -V -Q >> $PS # Finishing - gmt pscoast -R$EXTE $PRO $ORI -Df -EGL,SJ+gwhite -O -K >> $PS + gmt pscoast -R$EXTE $PRO $ORI -Df -ESJ+gwhite -O -K >> $PS gmt psxy ./../data/gis/islands.gmt -R$EXTE $PRO -Gp500/9:BlightgreyFwhite -O -K -V >> $PS - gmt pscoast -R$EXTE $PRO $ORI -Df -A$AREA+as+l -O -K -N1,thinnest,darkgray -Lg-125/-52.7+c0+w5000+f -Wthinnest,black -V >> $PS + gmt pscoast -R$EXTE $PRO $ORI -Df -A$AREA+as+l -O -K -N1/thinnest,darkgray -Lg-125/-52.7+c0+w5000+f -Wthinnest,black -V >> $PS + #gmt pscoast -R$EXTE $PRO $ORI -Df -A$AREA+as+l -O -K -N1,thinnest,darkgray -Lg-125/-52.7+c0+w5000+f -Wthinnest,black -V >> $PS # Plotting the colorscale gmt psscale -Dg95/-52.7+w13c/0.3c+e+h -O -C$CPTT2 -L -S -R$EXTE $PRO >> $PS @@ -141,7 +145,7 @@ plot() date # Cleaning - rm gmt.* + #rm gmt.* } From 0b3f48f20cce0ba4d5520fbd1d42efafd53fa4a7 Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Tue, 6 Jun 2023 14:45:50 +0200 Subject: [PATCH 16/20] for EUR and MIE --- openquake/ghm/mosaic.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openquake/ghm/mosaic.py b/openquake/ghm/mosaic.py index c42752cb1..3d56b1529 100644 --- a/openquake/ghm/mosaic.py +++ b/openquake/ghm/mosaic.py @@ -137,10 +137,14 @@ 'cea': ['KAZ', 'KGZ', 'TJK', 'TKM', 'UZB'], 'chn': ['CHN', 'Z02', 'Z03', 'Z08'], 'gld': ['GRL'], - 'mie': ['AFG', 'ARM', 'AZE', 'CYP', 'GEO', + #'mie': ['AFG', 'ARM', 'AZE', 'CYP', 'GEO', + # 'IRN', 'IRQ', 'ISR', 'JOR', 'KWT', + # 'LBN', 'PAK', 'Z06', 'PSA', 'PSE', + # 'SYR', 'TUR', 'ZNC'], + 'mie': ['AFG', 'ARM', 'AZE', 'GEO', 'IRN', 'IRQ', 'ISR', 'JOR', 'KWT', 'LBN', 'PAK', 'Z06', 'PSA', 'PSE', - 'SYR', 'TUR', 'ZNC'], + 'SYR'], 'eur': ['ALB', 'AND', 'AUT', 'BEL', 'BGR', 'BIH', 'BLR', 'CHE', 'CZE', 'DEU', 'DNK', 'ESP', 'EST', 'FIN', 'FRA', From 2ef14c7b2fe1d952c597ba2cd3f29f06744b5733 Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Tue, 6 Jun 2023 16:40:49 +0200 Subject: [PATCH 17/20] adding MIE-EUR contact --- .../ghm/data/gis/contacts_between_models.dbf | Bin 623 -> 644 bytes .../ghm/data/gis/contacts_between_models.shp | Bin 126288 -> 133752 bytes .../ghm/data/gis/contacts_between_models.shx | Bin 300 -> 308 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/openquake/ghm/data/gis/contacts_between_models.dbf b/openquake/ghm/data/gis/contacts_between_models.dbf index ab66aaa32deb9e2d79b289dfaccc5566a27da4fb..557c649370fdc8f1041edbe0a27b63325c3c4102 100644 GIT binary patch delta 37 icmaFQ(!$EhT+PNNwUITGNld{tG)Msgd_7&EEGYn)1qU7g delta 16 XcmZo+eb2(mT+PBJxsf%KiBSpwA`}B( diff --git a/openquake/ghm/data/gis/contacts_between_models.shp b/openquake/ghm/data/gis/contacts_between_models.shp index c169c624f9efdeeeab10455374ccdb085b69b694..6d961efc5884753d062761b9d51eb683a90f7d53 100644 GIT binary patch delta 7542 zcmZXZc{rAB)4<7=l%=A`gOVl55|yHiYa@{*Sra0=h$w|yDGHUPkdi1{5-LklD9RQJ zX;(=KMWjUKo9BIA&;1?8+aKNit~r;PIcMfvY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=wdjhl)3Cx`k;h*7->~2wzNE_jK9breNJ5OK8v^({}xt1o3Ko{|k}1 zS3Ba1rSLTeS9cW!-Xn9$o_NuaE*6s*f*piRJZrsOX{h3tjf%KS!EKq!+lxK05bd`= zJ9t*?V*wQK5tFxB5^%&0Np-JT=Bgu85P`eoakSDHB(W25&(H|M@>f z7I5xTo;hxaF5ER17>qBLhr5OsM*$65nqq0^Z{m{3Dy{ssmWFWI(eyyHP}p#XRX4r^ z=55`UJd75~CcFufl%kDHQf{eT`1^ktD!@Ph delta 19 bcmew{h2z34_6d^A4Bu8X%50TkGK From 9ae9dd80eab90b8166ab1672525f5731d03258d3 Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Mon, 19 Jun 2023 12:26:56 +0200 Subject: [PATCH 18/20] changes that make the script more flexible - saves a lot of computing time --- openquake/ghm/create_homogenised_curves.py | 52 +++++++++++++++++----- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/openquake/ghm/create_homogenised_curves.py b/openquake/ghm/create_homogenised_curves.py index 1e941bcc6..b98e5c37d 100755 --- a/openquake/ghm/create_homogenised_curves.py +++ b/openquake/ghm/create_homogenised_curves.py @@ -29,6 +29,7 @@ import re import glob import copy +import shutil import pickle import warnings import logging @@ -79,7 +80,7 @@ def find_hazard_curve_file(datafolder, vs30_flag, key, imt_str): String specifying the desired intensity measure type :param bool vs30_flag: - Flag to determine whether to search for files with vs30 in the folder path. + True (1) if building vs30 maps :return: A list with the files matching the pattern @@ -208,7 +209,8 @@ def get_imtls(poes): def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, imt_str, inland_shp, models_list=None, only_buffers=False, - buf=50, h3_resolution=6, mosaic_key='GID_0',vs30_flag=False,): + buf=50, h3_resolution=6, mosaic_key='GID_0',vs30_flag=False, + overwrite=False, sub=False): """ This function processes all the models listed in the mosaic.DATA dictionary. The code creates for the models in contact with other models @@ -236,6 +238,12 @@ def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, [optional] The h3 resolution :param mosaic_key: [optional] The key used to identify models + :param bool vs30_flag: + True (1) if building vs30 maps + :param bool overwrite: + True (1) to overwrite existing files + :param bool sub: + True (1) to create buffer map only for models in models_list """ shapely.speedups.enable() # Buffer distance in [m] @@ -249,7 +257,10 @@ def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, lst = glob.glob(os.path.join(outpath, '*.json')) lst += glob.glob(os.path.join(outpath, '*.txt')) if len(lst): - raise ValueError(f'The code requires an empty folder\n{outpath}') + if overwrite==True: + print('Warning: overwriting existing files in {}'.format(outpath)) + else: + raise ValueError(f'The code requires an empty folder\n{outpath}') else: os.mkdir(outpath) # Read the shapefile with the contacts between models @@ -265,6 +276,8 @@ def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, if models_list is None: models_list = [] for key in mosaic_data.keys(): + if vs30_flag and key=='gld': + continue models_list.append(re.sub('[0-9]+', '', key)) # Loop over the various models. TODO the value of the buffer here must @@ -282,6 +295,8 @@ def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, # Find name of the file with hazard curves print_model_info(i, key) data_fname = find_hazard_curve_file(datafolder, vs30_flag, key, imt_str) + print(data_fname[0]) + # Read hazard curves map_gdf, header = get_hcurves_geodataframe(data_fname[0]) @@ -512,10 +527,10 @@ def proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, pickle.dump(coords, fou) fou.close() - buffer_processing(outpath, imt_str, models_list, poelabs, buf) + buffer_processing(outpath, imt_str, models_list, poelabs, buf, vs30_flag, sub) -def buffer_processing(outpath, imt_str, models_list, poelabs, buf): +def buffer_processing(outpath, imt_str, models_list, poelabs, buf, vs30_flag, sub=True): """ Buffer processing @@ -530,6 +545,8 @@ def buffer_processing(outpath, imt_str, models_list, poelabs, buf): and containing the hazard curves :param buf: The buffer distance in km + :param bool vs30_flag: + True (1) if building vs30 maps """ print('Buffer processing') @@ -543,8 +560,12 @@ def buffer_processing(outpath, imt_str, models_list, poelabs, buf): tmpdir = os.path.join(outpath, 'temp') for i, key in enumerate(sorted(mosaic_data)): - # Skip models not included in the list - if re.sub('[0-9]+', '', key) not in models_list: + # Skip models not included in the list. + # comment out these lines if wanting to join + # all the models, but some have been produced in former runs + if re.sub('[0-9]+', '', key) not in models_list and sub==True: + continue + if key == 'gld' and vs30_flag == 1: continue print(f' Loading {key:s}') @@ -650,15 +671,24 @@ def buffer_processing(outpath, imt_str, models_list, poelabs, buf): fuu.close() def process(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, - imt_str, inland_shp, buf,vs30_flag, *, models_list=None, only_buffers=False, - h3_resolution=6, mosaic_key='GID_0'): + imt_str, inland_shp, buf, vs30_flag, *, models_list=None, only_buffers=False, + h3_resolution=6, mosaic_key='GID_0', foverwrite=False, sub=False): """ This function processes all the models listed in the mosaic.DATA dictionary and creates homogenised curves. + + Example use that recreates the curves (model and buffer regions) for EUR and MIE models, + overwriting them in their existing folder (/home/hazard/mosaic/../ghm/PGA-rock) and + generating the buffer shapefiles for the full globe + + ./create_homogenised_curves.py ./../data/gis/contacts_between_models.shp + /home/hazard/mosaic/../ghm/PGA-rock /home/hazard/mosaic ../GGrid/trigrd_split_9_spacing_13 + /home/hazard/mosaic/../gadm_410_level_0.gpkg PGA ./../data/gis/inland.shp 50.0 0 + -m "eur,mie" -f 1 """ proc(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, imt_str, inland_shp, models_list, only_buffers, buf, h3_resolution, - mosaic_key, vs30_flag) + mosaic_key, vs30_flag, float(foverwrite), sub) process.contacts_shp = 'Name of shapefile with contacts' @@ -673,6 +703,8 @@ def process(contacts_shp, outpath, datafolder, sidx_fname, boundaries_shp, process.models_list = 'List of models to be processed' process.h3_resolution = 'H3 resolution used to create the grid of sites' process.mosaic_key = 'The key used to specify countries' +process.foverwrite = 'Boolean to allow overwriting of files' +process.sub = 'Boolean to create subset according to models_list' if __name__ == "__main__": sap.run(process) From 27c65d90098e056073b11b1efb30e7e7fe37bc06 Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Mon, 19 Jun 2023 12:29:18 +0200 Subject: [PATCH 19/20] adding notes to mosaic.py --- openquake/ghm/mosaic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openquake/ghm/mosaic.py b/openquake/ghm/mosaic.py index 3d56b1529..850ba9b25 100644 --- a/openquake/ghm/mosaic.py +++ b/openquake/ghm/mosaic.py @@ -137,14 +137,17 @@ 'cea': ['KAZ', 'KGZ', 'TJK', 'TKM', 'UZB'], 'chn': ['CHN', 'Z02', 'Z03', 'Z08'], 'gld': ['GRL'], + # for placing Turkey, Cyprus, North Cyprus in MIE #'mie': ['AFG', 'ARM', 'AZE', 'CYP', 'GEO', # 'IRN', 'IRQ', 'ISR', 'JOR', 'KWT', # 'LBN', 'PAK', 'Z06', 'PSA', 'PSE', # 'SYR', 'TUR', 'ZNC'], + # for placing Turkey, Cyprus, North Cyprus in EUR 'mie': ['AFG', 'ARM', 'AZE', 'GEO', 'IRN', 'IRQ', 'ISR', 'JOR', 'KWT', 'LBN', 'PAK', 'Z06', 'PSA', 'PSE', 'SYR'], + # for placing Turkey, Cyprus, North Cyprus in EUR 'eur': ['ALB', 'AND', 'AUT', 'BEL', 'BGR', 'BIH', 'BLR', 'CHE', 'CZE', 'DEU', 'DNK', 'ESP', 'EST', 'FIN', 'FRA', @@ -188,7 +191,6 @@ 'UGA', 'ZMB', 'ZWE'], 'twn': ['TWN'], 'usa': ['USA', 'CAL'], -# 'ucf': ['CAL'], ## UCF merged with USA 'waf': ['AGO', 'BEN', 'BFA', 'BWA', 'CAF', 'CIV', 'CMR', 'COD', 'COG', 'DZA', 'GAB', 'GHA', 'GIN', 'GMB', 'GNB', From 93b56fbb337f63d87f625b29494a83e53b27eba5 Mon Sep 17 00:00:00 2001 From: Kendra Johnson Date: Mon, 19 Jun 2023 12:30:07 +0200 Subject: [PATCH 20/20] putting standard for CAN --- openquake/ghm/mosaic.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openquake/ghm/mosaic.py b/openquake/ghm/mosaic.py index 850ba9b25..706ad9123 100644 --- a/openquake/ghm/mosaic.py +++ b/openquake/ghm/mosaic.py @@ -125,8 +125,7 @@ 'arb': ['ARE', 'BHR', 'OMN', 'QAT', 'SAU', 'YEM'], 'aus': ['AUS'], - #'can': ['CAN'], ##temporary fix to use CND and not CAN - 'cnd': ['CAN'], + 'can': ['CAN'], 'cca': ['ABW', 'AIA', 'ATG', 'BHS', 'BLZ', 'BRB', 'CCY', 'CRI', 'CUB', 'CYM', 'DMA', 'DOM', 'GLP', 'GRD', 'GTM',