From 2085338b2db5e9931c565bc8898775f3f6fe4f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Umur=20Din=C3=A7?= Date: Thu, 13 Apr 2023 11:50:40 +0300 Subject: [PATCH 01/63] added grib2 table parameter codes according to new ECMWF open data I added grib2 table parameter codes according to https://data.ecmwf.int/forecasts/ dataset in the link. ECMWF made some of the variables open in 0.4 resolution. But unfortunately, it does not cover all the variables required to run WRF but can be mixed with other datasets. I also added the grib1 param code for geopotential height. --- ungrib/Variable_Tables/Vtable.ECMWF | 66 ++++++++++++++--------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/ungrib/Variable_Tables/Vtable.ECMWF b/ungrib/Variable_Tables/Vtable.ECMWF index 1a54514f7..7e53ce4a0 100644 --- a/ungrib/Variable_Tables/Vtable.ECMWF +++ b/ungrib/Variable_Tables/Vtable.ECMWF @@ -1,36 +1,36 @@ -GRIB | Level| Level| Level| metgrid | metgrid | metgrid | -Code | Code | 1 | 2 | Name | Units | Description | ------+------+------+------+----------+----------+------------------------------------------+ - 129 | 100 | * | | GEOPT | m2 s-2 | | - | 100 | * | | HGT | m | Height | - 130 | 100 | * | | TT | K | Temperature | - 131 | 100 | * | | UU | m s-1 | U | - 132 | 100 | * | | VV | m s-1 | V | - 157 | 100 | * | | RH | % | Relative Humidity | - 165 | 1 | 0 | | UU | m s-1 | U At 10 m | - 166 | 1 | 0 | | VV | m s-1 | V At 10 m | - 167 | 1 | 0 | | TT | K | Temperature At 2 m | - 168 | 1 | 0 | | DEWPT | K | | - | 1 | 0 | | RH | % | Relative Humidity At 2 m | - 172 | 1 | 0 | | LANDSEA | 0/1 Flag | Land/Sea flag | - 129 | 1 | 0 | | SOILGEO | m2 s-2 | | - | 1 | 0 | | SOILHGT | m | Terrain field of source analysis | - 134 | 1 | 0 | | PSFC | Pa | Surface Pressure | - 151 | 1 | 0 | | PMSL | Pa | Sea-level Pressure | - 235 | 1 | 0 | | SKINTEMP | K | Sea-Surface Temperature | - 31 | 1 | 0 | | SEAICE | 0/1 Flag | Sea-Ice-Flag | - 34 | 1 | 0 | | SST | K | Sea-Surface Temperature | - 141 | 1 | 0 | | SNOW_EC | m | | - | 1 | 0 | | SNOW | kg m-2 |Water Equivalent of Accumulated Snow Depth| - 139 | 112 | 0 | 7 | ST000007 | K | T of 0-7 cm ground layer | - 170 | 112 | 7 | 28 | ST007028 | K | T of 7-28 cm ground layer | - 183 | 112 | 28 | 100 | ST028100 | K | T of 28-100 cm ground layer | - 236 | 112 | 100 | 255 | ST100289 | K | T of 100-289 cm ground layer | - 39 | 112 | 0 | 7 | SM000007 | fraction | Soil moisture of 0-7 cm ground layer | - 40 | 112 | 7 | 28 | SM007028 | fraction | Soil moisture of 7-28 cm ground layer | - 41 | 112 | 28 | 100 | SM028100 | fraction | Soil moisture of 28-100 cm ground layer | - 42 | 112 | 100 | 255 | SM100289 | fraction | Soil moisture of 100-289 cm ground layer | ------+------+------+------+----------+----------+------------------------------------------+ +GRIB1| Level| From | To | metgrid | metgrid | metgrid |GRIB2|GRIB2|GRIB2|GRIB2| +Param| Type |Level1|Level2| Name | Units | Description |Discp|Catgy|Param|Level| +-----+------+------+------+----------+---------+-------------------------------------------+-----------------------+ + 129 | 100 | * | | GEOPT | m2 s-2 | | 0 | 0 | | 100 | + 156 | 100 | * | | HGT | m | Height | 0 | 3 | 5 | 100 | + 130 | 100 | * | | TT | K | Temperature | 0 | 0 | 0 | 100 | + 131 | 100 | * | | UU | m s-1 | U | 0 | 2 | 2 | 100 | + 132 | 100 | * | | VV | m s-1 | V | 0 | 2 | 3 | 100 | + 157 | 100 | * | | RH | % | Relative Humidity | 0 | 1 | 1 | 100 | + 165 | 1 | 0 | | UU | m s-1 | U At 10 m | 0 | 2 | 2 | 103 | + 166 | 1 | 0 | | VV | m s-1 | V At 10 m | 0 | 2 | 3 | 103 | + 167 | 1 | 0 | | TT | K | Temperature At 2 m | 0 | 0 | 0 | 103 | + 168 | 1 | 0 | | DEWPT | K | | 0 | 0 | | 103 | + | 1 | 0 | | RH | % | Relative Humidity At 2 m | 0 | 0 | | 103 | + 172 | 1 | 0 | | LANDSEA | 0/1 Flag | Land/Sea flag | 0 | 0 | | 103 | + 129 | 1 | 0 | | SOILGEO | m2 s-2 | | 0 | 0 | | 103 | + | 1 | 0 | | SOILHGT | m | Terrain field of source analysis | 0 | 0 | | 106 | + 134 | 1 | 0 | | PSFC | Pa | Surface Pressure | 0 | 3 | 0 | 1 | + 151 | 1 | 0 | | PMSL | Pa | Sea-level Pressure | 0 | 3 | 0 | 101 | + 235 | 1 | 0 | | SKINTEMP | K | Sea-Surface Temperature | 0 | 3 | | 101 | + 31 | 1 | 0 | | SEAICE | 0/1 Flag | Sea-Ice-Flag | 0 | 3 | | 101 | + 34 | 1 | 0 | | SST | K | Sea-Surface Temperature | 0 | 3 | | 101 | + 141 | 1 | 0 | | SNOW_EC | m | | 0 | 3 | | 101 | + | 1 | 0 | | SNOW | kg m-2 |Water Equivalent of Accumulated Snow Depth| 0 | 3 | | 101 | + 139 | 112 | 0 | 7 | ST000007 | K | T of 0-7 cm ground layer | 0 | 0 | | 106 | + 170 | 112 | 7 | 28 | ST007028 | K | T of 7-28 cm ground layer | 0 | 0 | | 106 | + 183 | 112 | 28 | 100 | ST028100 | K | T of 28-100 cm ground layer | 0 | 0 | | 106 | + 236 | 112 | 100 | 255 | ST100289 | K | T of 100-289 cm ground layer | 0 | 0 | | 106 | + 39 | 112 | 0 | 7 | SM000007 | fraction | Soil moisture of 0-7 cm ground layer | 0 | 0 | | 106 | + 40 | 112 | 7 | 28 | SM007028 | fraction | Soil moisture of 7-28 cm ground layer | 0 | 0 | | 106 | + 41 | 112 | 28 | 100 | SM028100 | fraction | Soil moisture of 28-100 cm ground layer | 0 | 0 | | 106 | + 42 | 112 | 100 | 255 | SM100289 | fraction | Soil moisture of 100-289 cm ground layer | 0 | 0 | | 106 | +-----+------+------+------+----------+----------+------------------------------------------+-----+-----+-----+-----+ # # Grib codes are from Table 128 # http://old.ecmwf.int/publications/manuals/d/gribapi/param/filter=grib1/order=paramId/order_type=asc/p=1/table=128/ From a1ad34b0bf6cbb1c4efcb1abc9ccad47041c9c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Umur=20Din=C3=A7?= Date: Fri, 14 Apr 2023 09:30:00 +0300 Subject: [PATCH 02/63] Update Vtable.ECMWF also added land-sea mask and 0-7 soil temperature --- ungrib/Variable_Tables/Vtable.ECMWF | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ungrib/Variable_Tables/Vtable.ECMWF b/ungrib/Variable_Tables/Vtable.ECMWF index 7e53ce4a0..00dd0e6bb 100644 --- a/ungrib/Variable_Tables/Vtable.ECMWF +++ b/ungrib/Variable_Tables/Vtable.ECMWF @@ -12,7 +12,7 @@ Param| Type |Level1|Level2| Name | Units | Description 167 | 1 | 0 | | TT | K | Temperature At 2 m | 0 | 0 | 0 | 103 | 168 | 1 | 0 | | DEWPT | K | | 0 | 0 | | 103 | | 1 | 0 | | RH | % | Relative Humidity At 2 m | 0 | 0 | | 103 | - 172 | 1 | 0 | | LANDSEA | 0/1 Flag | Land/Sea flag | 0 | 0 | | 103 | + 172 | 1 | 0 | | LANDSEA | 0/1 Flag | Land/Sea flag | 2 | 0 | 0 | 1 | 129 | 1 | 0 | | SOILGEO | m2 s-2 | | 0 | 0 | | 103 | | 1 | 0 | | SOILHGT | m | Terrain field of source analysis | 0 | 0 | | 106 | 134 | 1 | 0 | | PSFC | Pa | Surface Pressure | 0 | 3 | 0 | 1 | @@ -22,14 +22,14 @@ Param| Type |Level1|Level2| Name | Units | Description 34 | 1 | 0 | | SST | K | Sea-Surface Temperature | 0 | 3 | | 101 | 141 | 1 | 0 | | SNOW_EC | m | | 0 | 3 | | 101 | | 1 | 0 | | SNOW | kg m-2 |Water Equivalent of Accumulated Snow Depth| 0 | 3 | | 101 | - 139 | 112 | 0 | 7 | ST000007 | K | T of 0-7 cm ground layer | 0 | 0 | | 106 | - 170 | 112 | 7 | 28 | ST007028 | K | T of 7-28 cm ground layer | 0 | 0 | | 106 | - 183 | 112 | 28 | 100 | ST028100 | K | T of 28-100 cm ground layer | 0 | 0 | | 106 | - 236 | 112 | 100 | 255 | ST100289 | K | T of 100-289 cm ground layer | 0 | 0 | | 106 | - 39 | 112 | 0 | 7 | SM000007 | fraction | Soil moisture of 0-7 cm ground layer | 0 | 0 | | 106 | - 40 | 112 | 7 | 28 | SM007028 | fraction | Soil moisture of 7-28 cm ground layer | 0 | 0 | | 106 | - 41 | 112 | 28 | 100 | SM028100 | fraction | Soil moisture of 28-100 cm ground layer | 0 | 0 | | 106 | - 42 | 112 | 100 | 255 | SM100289 | fraction | Soil moisture of 100-289 cm ground layer | 0 | 0 | | 106 | + 139 | 112 | 0 | 7 | ST000007 | K | T of 0-7 cm ground layer | 2 | 0 | 2 | 106 | + 170 | 112 | 7 | 28 | ST007028 | K | T of 7-28 cm ground layer | 2 | 0 | | 106 | + 183 | 112 | 28 | 100 | ST028100 | K | T of 28-100 cm ground layer | 2 | 0 | | 106 | + 236 | 112 | 100 | 255 | ST100289 | K | T of 100-289 cm ground layer | 2 | 0 | | 106 | + 39 | 112 | 0 | 7 | SM000007 | fraction | Soil moisture of 0-7 cm ground layer | 2 | 0 | | 106 | + 40 | 112 | 7 | 28 | SM007028 | fraction | Soil moisture of 7-28 cm ground layer | 2 | 0 | | 106 | + 41 | 112 | 28 | 100 | SM028100 | fraction | Soil moisture of 28-100 cm ground layer | 2 | 0 | | 106 | + 42 | 112 | 100 | 255 | SM100289 | fraction | Soil moisture of 100-289 cm ground layer | 2 | 0 | | 106 | -----+------+------+------+----------+----------+------------------------------------------+-----+-----+-----+-----+ # # Grib codes are from Table 128 From 4c7d3ef5edbb65fe394fc049df1dbef20e4661ed Mon Sep 17 00:00:00 2001 From: Kelly Werner Date: Wed, 4 Oct 2023 11:39:34 -0600 Subject: [PATCH 03/63] changed 'soilgrids' in path & interp option to 'default' --- geogrid/GEOGRID.TBL.ARW.noahmp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/geogrid/GEOGRID.TBL.ARW.noahmp b/geogrid/GEOGRID.TBL.ARW.noahmp index 5bfeaa01b..55f2fedf3 100644 --- a/geogrid/GEOGRID.TBL.ARW.noahmp +++ b/geogrid/GEOGRID.TBL.ARW.noahmp @@ -1079,11 +1079,11 @@ name=SOILCOMP priority=1 optional=yes dest_type=continuous - interp_option=soilgrids:average_gcell(0.0)+average_4pt+average_16pt + interp_option=default:average_gcell(0.0)+average_4pt+average_16pt z_dim_name=soilcomp masked = water fill_missing = 0. - rel_path=soilgrids:soilgrids/soilcomp/ + rel_path=default:soilgrids/soilcomp/ =============================== name=SOILCL1F priority=1 @@ -1091,8 +1091,8 @@ name=SOILCL1F dest_type=categorical z_dim_name=soil_cat dominant=SOILCL1 - interp_option = soilgrids:nearest_neighbor - rel_path= soilgrids:soilgrids/texture_layer1/ + interp_option = default:nearest_neighbor + rel_path= default:soilgrids/texture_layer1/ =============================== name=SOILCL2F priority=1 @@ -1100,8 +1100,8 @@ name=SOILCL2F dest_type=categorical z_dim_name=soil_cat dominant=SOILCL2 - interp_option = soilgrids:nearest_neighbor - rel_path= soilgrids:soilgrids/texture_layer2/ + interp_option = default:nearest_neighbor + rel_path= default:soilgrids/texture_layer2/ =============================== name=SOILCL3F priority=1 @@ -1109,8 +1109,8 @@ name=SOILCL3F dest_type=categorical z_dim_name=soil_cat dominant=SOILCL3 - interp_option = soilgrids:nearest_neighbor - rel_path= soilgrids:soilgrids/texture_layer3/ + interp_option = default:nearest_neighbor + rel_path= default:soilgrids/texture_layer3/ =============================== name=SOILCL4F priority=1 @@ -1118,6 +1118,6 @@ name=SOILCL4F dest_type=categorical z_dim_name=soil_cat dominant=SOILCL4 - interp_option = soilgrids:nearest_neighbor - rel_path= soilgrids:soilgrids/texture_layer4/ + interp_option = default:nearest_neighbor + rel_path= default:soilgrids/texture_layer4/ =============================== From ee6eda119a10db430154461dca6494d10c1d04c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Umur=20Din=C3=A7?= Date: Wed, 29 Nov 2023 15:04:40 +0300 Subject: [PATCH 04/63] Update Vtable.ECMWF added soil height to GRIB1 Param --- ungrib/Variable_Tables/Vtable.ECMWF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ungrib/Variable_Tables/Vtable.ECMWF b/ungrib/Variable_Tables/Vtable.ECMWF index 00dd0e6bb..8b132433f 100644 --- a/ungrib/Variable_Tables/Vtable.ECMWF +++ b/ungrib/Variable_Tables/Vtable.ECMWF @@ -14,7 +14,7 @@ Param| Type |Level1|Level2| Name | Units | Description | 1 | 0 | | RH | % | Relative Humidity At 2 m | 0 | 0 | | 103 | 172 | 1 | 0 | | LANDSEA | 0/1 Flag | Land/Sea flag | 2 | 0 | 0 | 1 | 129 | 1 | 0 | | SOILGEO | m2 s-2 | | 0 | 0 | | 103 | - | 1 | 0 | | SOILHGT | m | Terrain field of source analysis | 0 | 0 | | 106 | + 156 | 1 | 0 | | SOILHGT | m | Terrain field of source analysis | 0 | 0 | | 106 | 134 | 1 | 0 | | PSFC | Pa | Surface Pressure | 0 | 3 | 0 | 1 | 151 | 1 | 0 | | PMSL | Pa | Sea-level Pressure | 0 | 3 | 0 | 101 | 235 | 1 | 0 | | SKINTEMP | K | Sea-Surface Temperature | 0 | 3 | | 101 | From 3cfcf343434e285c28a171039b727a85228f4286 Mon Sep 17 00:00:00 2001 From: Do Ngoc Khanh <14163153+ngockhanhdo1997@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:48:34 +0900 Subject: [PATCH 05/63] Add variables needed for slucm with 2d urban parameters --- geogrid/GEOGRID.TBL.ARW | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/geogrid/GEOGRID.TBL.ARW b/geogrid/GEOGRID.TBL.ARW index a8a2681a7..dd0dea61d 100644 --- a/geogrid/GEOGRID.TBL.ARW +++ b/geogrid/GEOGRID.TBL.ARW @@ -39,6 +39,8 @@ name=LANDUSEF landmask_water = usgs_30s:16 # Calculate a landmask from this field landmask_water = usgs_lakes:16,28 # Calculate a landmask from this field landmask_water = modis_lakes:17,21 # Calculate a landmask from this field + landmask_water = modis_2010:17 # Calculate a landmask from this field + landmask_water = modis_2050:17 # Calculate a landmask from this field landmask_water = usgs_2m:16 # Calculate a landmask from this field landmask_water = usgs_5m:16 # Calculate a landmask from this field landmask_water = usgs_10m:16 # Calculate a landmask from this field @@ -57,6 +59,8 @@ name=LANDUSEF interp_option = usgs_30s:nearest_neighbor interp_option = usgs_lakes:nearest_neighbor interp_option = modis_lakes:nearest_neighbor + interp_option = modis_2010:nearest_neighbor + interp_option = modis_2050:nearest_neighbor interp_option = usgs_2m:four_pt interp_option = usgs_5m:four_pt interp_option = usgs_10m:four_pt @@ -75,6 +79,8 @@ name=LANDUSEF rel_path = usgs_30s:landuse_30s/ rel_path = usgs_lakes:landuse_30s_with_lakes/ rel_path = modis_lakes:modis_landuse_21class_30s/ + rel_path = modis_2010:modis_landuse_20class_15s_2010s/ + rel_path = modis_2050:modis_landuse_20class_15s_2050s/ rel_path = usgs_2m:landuse_2m/ rel_path = usgs_5m:landuse_5m/ rel_path = usgs_10m:landuse_10m/ @@ -966,3 +972,75 @@ name = BATHYMETRY rel_path = default:topobath_30s/ flag_in_output=FLAG_BATHYMETRY =============================== +name = MH_URB2D + priority=1 + optional=yes + dest_type=continuous + fill_missing = 0. + interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt + interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt + rel_path = y2010_urb:urban_params/2010/H_avg/ + rel_path = y2050_urb:urban_params/2050/H_avg/ +=============================== +name = ZD_URB2D + priority=1 + optional=yes + dest_type=continuous + fill_missing = 0. + interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt + interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt + rel_path = y2010_urb:urban_params/2010/d/ + rel_path = y2050_urb:urban_params/2050/d/ +=============================== +name = Z0_URB2D + priority=1 + optional=yes + dest_type=continuous + fill_missing = 0. + interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt + interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt + rel_path = y2010_urb:urban_params/2010/z_0/ + rel_path = y2050_urb:urban_params/2050/z_0/ +=============================== +name = BUILD_AREA_FRACTION + priority=1 + optional=yes + dest_type=continuous + fill_missing = 0. + interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt + interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt + rel_path = y2010_urb:urban_params/2010/lambda_p/ + rel_path = y2050_urb:urban_params/2050/lambda_p/ +=============================== +name = LF_URB2D_S + priority=1 + optional=yes + dest_type=continuous + fill_missing = 0. + interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt + interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt + rel_path = y2010_urb:urban_params/2010/lambda_f/ + rel_path = y2050_urb:urban_params/2050/lambda_f/ +=============================== +name = AHE + priority=1 + optional=yes + dest_type=continuous + fill_missing = 0. + interp_option = y2010_ahe:average_gcell(4.0)+four_pt+average_4pt + interp_option = y2050_ahe:average_gcell(4.0)+four_pt+average_4pt + rel_path = y2010_ahe:AHE_2010s/2_bytes/ + rel_path = y2050_ahe:AHE_2050s/2_bytes/ + z_dim_name = month_hour +=============================== +name = AHE + priority=2 + optional=yes + dest_type=continuous + fill_missing = 0. + interp_option = y2010_ahe:average_gcell(4.0)+four_pt+average_4pt + interp_option = y2050_ahe:average_gcell(4.0)+four_pt+average_4pt + rel_path = y2010_ahe:AHE_2010s/3_bytes/ + rel_path = y2050_ahe:AHE_2050s/3_bytes/ + z_dim_name = month_hour +=============================== From ac0b1886641680d0e263ab6b841cdc6c1b88b344 Mon Sep 17 00:00:00 2001 From: Do Ngoc Khanh <14163153+ngockhanhdo1997@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:17:34 +0900 Subject: [PATCH 06/63] Add lakes --- geogrid/GEOGRID.TBL.ARW | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/geogrid/GEOGRID.TBL.ARW b/geogrid/GEOGRID.TBL.ARW index dd0dea61d..ad52b3a29 100644 --- a/geogrid/GEOGRID.TBL.ARW +++ b/geogrid/GEOGRID.TBL.ARW @@ -40,7 +40,9 @@ name=LANDUSEF landmask_water = usgs_lakes:16,28 # Calculate a landmask from this field landmask_water = modis_lakes:17,21 # Calculate a landmask from this field landmask_water = modis_2010:17 # Calculate a landmask from this field + landmask_water = modis_2010_lake:17,21 # Calculate a landmask from this field landmask_water = modis_2050:17 # Calculate a landmask from this field + landmask_water = modis_2050_lake:17,21 # Calculate a landmask from this field landmask_water = usgs_2m:16 # Calculate a landmask from this field landmask_water = usgs_5m:16 # Calculate a landmask from this field landmask_water = usgs_10m:16 # Calculate a landmask from this field @@ -60,7 +62,9 @@ name=LANDUSEF interp_option = usgs_lakes:nearest_neighbor interp_option = modis_lakes:nearest_neighbor interp_option = modis_2010:nearest_neighbor + interp_option = modis_2010_lake:nearest_neighbor interp_option = modis_2050:nearest_neighbor + interp_option = modis_2050_lake:nearest_neighbor interp_option = usgs_2m:four_pt interp_option = usgs_5m:four_pt interp_option = usgs_10m:four_pt @@ -80,7 +84,9 @@ name=LANDUSEF rel_path = usgs_lakes:landuse_30s_with_lakes/ rel_path = modis_lakes:modis_landuse_21class_30s/ rel_path = modis_2010:modis_landuse_20class_15s_2010s/ + rel_path = modis_2010_lake:modis_landuse_20class_15s_2010s_with_lakes/ rel_path = modis_2050:modis_landuse_20class_15s_2050s/ + rel_path = modis_2050_lake:modis_landuse_20class_15s_2050s_with_lakes/ rel_path = usgs_2m:landuse_2m/ rel_path = usgs_5m:landuse_5m/ rel_path = usgs_10m:landuse_10m/ From 429d7da8ee226b39bbc4fb1aeea9b3f3c35e370d Mon Sep 17 00:00:00 2001 From: Do Ngoc Khanh <14163153+ngockhanhdo1997@users.noreply.github.com> Date: Fri, 16 Feb 2024 13:46:45 +0900 Subject: [PATCH 07/63] Add CGLS vegetation --- geogrid/GEOGRID.TBL.ARW | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/geogrid/GEOGRID.TBL.ARW b/geogrid/GEOGRID.TBL.ARW index ad52b3a29..900c20162 100644 --- a/geogrid/GEOGRID.TBL.ARW +++ b/geogrid/GEOGRID.TBL.ARW @@ -161,6 +161,8 @@ name=ALBEDO12M name=GREENFRAC priority=1 dest_type=continuous + interp_option=cgls_veg:average_gcell(4.0)+four_pt+average_4pt+average_16pt + interp_option=modis_veg_no_search:average_gcell(4.0)+four_pt+average_4pt+average_16pt interp_option=modis_fpar:average_gcell(4.0)+four_pt+average_4pt+average_16pt+search interp_option=nesdis_greenfrac:four_pt+average_4pt+average_16pt+search interp_option= lowres:average_gcell(4.0)+four_pt+wt_average_4pt+wt_average_16pt+search @@ -168,6 +170,8 @@ name=GREENFRAC z_dim_name=month masked = water fill_missing = 0. + rel_path=cgls_veg:greenfrac_fcover_cgls/ + rel_path=modis_veg_no_search:greenfrac_fpar_modis/ rel_path=modis_fpar:greenfrac_fpar_modis/ rel_path=nesdis_greenfrac:greenfrac/ rel_path= lowres:greenfrac_fpar_modis_5m/ @@ -176,12 +180,16 @@ name=GREENFRAC name=LAI12M priority=1 dest_type=continuous + interp_option=cgls_veg:average_gcell(4.0)+four_pt+average_4pt+average_16pt + interp_option=modis_veg_no_search:average_gcell(4.0)+four_pt+average_4pt+average_16pt interp_option=modis_lai:average_gcell(4.0)+four_pt+average_4pt+average_16pt+search interp_option= lowres:average_gcell(4.0)+four_pt+wt_average_4pt+wt_average_16pt+search interp_option=default:average_gcell(4.0)+four_pt+average_4pt+average_16pt+search z_dim_name=month masked = water fill_missing = 0. + rel_path=cgls_veg:lai_cgls/ + rel_path=modis_veg_no_search:lai_modis_30s/ rel_path=modis_lai:lai_modis_30s/ rel_path= lowres:lai_modis_10m/ rel_path=default:lai_modis_10m/ From 48f7904d013929a53524f3ca79c7654cddc11f9a Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 28 Jun 2023 17:29:46 -0600 Subject: [PATCH 08/63] Fixing stanzas to appropriately break out flags and be sanitized correctly --- arch/configure.defaults | 206 ++++++++++++++++-------- arch/configure_reader.py | 334 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 473 insertions(+), 67 deletions(-) create mode 100755 arch/configure_reader.py diff --git a/arch/configure.defaults b/arch/configure.defaults index 25382bab0..827bac2c6 100644 --- a/arch/configure.defaults +++ b/arch/configure.defaults @@ -10,9 +10,13 @@ FC = mpifort SFC = xlf2003_r CC = mpicc SCC = xlc_r +DM_FC = mpifort +DM_CC = mpicc LD = $(FC) -FFLAGS = -qfree=f90 -qufmt=be -F77FLAGS = -qfixed -qufmt=be +FFLAGS = $(FORMAT_FREE) -qufmt=be +F77FLAGS = $(FORMAT_FIXED) -qufmt=be +FORMAT_FREE = -qfree=f90 +FORMAT_FIXED = -qfixed FNGFLAGS = $(FFLAGS) LDFLAGS = CFLAGS = @@ -31,9 +35,13 @@ FC = mpifort SFC = pgfortran CC = mpicc SCC = pgcc +DM_FC = mpifort +DM_CC = mpicc LD = $(FC) -FFLAGS = -Mfree -byteswapio -F77FLAGS = -Mfixed -byteswapio +FFLAGS = $(FORMAT_FREE) -byteswapio +F77FLAGS = $(FORMAT_FIXED) -byteswapio +FORMAT_FREE = -Mfree +FORMAT_FIXED = -Mfixed FNGFLAGS = $(FFLAGS) LDFLAGS = CFLAGS = @@ -55,9 +63,13 @@ MPI_LIB = -L$(BGL_SYS)/lib -lmpich.rts -lmsglayer.rts -lrts.rts -lde FC = blrts_xlf90 SFC = blrts_xlf90 CC = blrts_xlc +DM_FC = blrts_xlf90 +DM_CC = blrts_xlc LD = $(FC) -FFLAGS = -qfree=f90 $(MPI_INC) -F77FLAGS = -qfixed $(MPI_INC) +FFLAGS = $(FORMAT_FREE) $(MPI_INC) +F77FLAGS = $(FORMAT_FIXED) $(MPI_INC) +FORMAT_FREE = -qfree=f90 +FORMAT_FIXED = -qfixed FNGFLAGS = $(FFLAGS) LDFLAGS = SCC = cc @@ -85,8 +97,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -Mfree -byteswapio -O -F77FLAGS = -Mfixed -byteswapio -O +FFLAGS = $(FORMAT_FREE) -byteswapio -O +F77FLAGS = $(FORMAT_FIXED) -byteswapio -O +FORMAT_FREE = -Mfree +FORMAT_FIXED = -Mfixed FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -109,8 +123,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -FR -convert big_endian -F77FLAGS = -FI -convert big_endian +FFLAGS = $(FORMAT_FREE) -convert big_endian +F77FLAGS = $(FORMAT_FIXED) -convert big_endian +FORMAT_FREE = -FR +FORMAT_FIXED = -FI FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -133,8 +149,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -ffree-form -O -fendian=big -F77FLAGS = -ffixed-form -O -fendian=big +FFLAGS = $(FORMAT_FREE) -O -fendian=big +F77FLAGS = $(FORMAT_FIXED) -O -fendian=big +FORMAT_FREE = -ffree-form +FORMAT_FIXED = -ffixed-form FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -157,8 +175,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4 -F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4 +FFLAGS = $(FORMAT_FREE) -O -fconvert=big-endian -frecord-marker=4 +F77FLAGS = $(FORMAT_FIXED) -O -fconvert=big-endian -frecord-marker=4 +FORMAT_FREE = -ffree-form +FORMAT_FIXED = -ffixed-form FCCOMPAT = CONFIGURE_COMPAT_FLAGS FCSUFFIX = FNGFLAGS = $(FFLAGS) @@ -181,8 +201,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4 -F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4 +FFLAGS = $(FORMAT_FREE) -O -fconvert=big-endian -frecord-marker=4 +F77FLAGS = $(FORMAT_FIXED) -O -fconvert=big-endian -frecord-marker=4 +FORMAT_FREE = -ffree-form +FORMAT_FIXED = -ffixed-form FCCOMPAT = CONFIGURE_COMPAT_FLAGS FCSUFFIX = FNGFLAGS = $(FFLAGS) @@ -207,8 +229,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -Mfree -byteswapio -O -F77FLAGS = -Mfixed -byteswapio -O +FFLAGS = $(FORMAT_FREE) -byteswapio -O +F77FLAGS = $(FORMAT_FIXED) -byteswapio -O +FORMAT_FREE = -Mfree +FORMAT_FIXED = -Mfixed FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -233,8 +257,10 @@ DM_CC = $(SCC) -I$(MPI_ROOT)/include FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -Mfree -byteswapio -O -F77FLAGS = -Mfixed -byteswapio -O +FFLAGS = $(FORMAT_FREE) -byteswapio -O +F77FLAGS = $(FORMAT_FIXED) -byteswapio -O +FORMAT_FREE = -Mfree +FORMAT_FIXED = -Mfixed FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = -L$(MPI_ROOT)/lib -lmpi @@ -257,8 +283,10 @@ DM_CC = mpicc -cc=pathcc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -freeform -fno-second-underscore -byteswapio -O -F77FLAGS = -byteswapio -fno-second-underscore -O +FFLAGS = $(FORMAT_FREE) -fno-second-underscore -byteswapio -O +F77FLAGS = $(FORMAT_FIXED) -byteswapio -fno-second-underscore -O +FORMAT_FREE = -freeform +FORMAT_FIXED = FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -281,8 +309,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -FR -convert big_endian -F77FLAGS = -FI -convert big_endian +FFLAGS = $(FORMAT_FREE) -convert big_endian +F77FLAGS = $(FORMAT_FIXED) -convert big_endian +FORMAT_FREE = -FR +FORMAT_FIXED = -FI FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -305,8 +335,10 @@ DM_CC = $(SCC) -I$(MPI_ROOT)/include FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -FR -convert big_endian -F77FLAGS = -FI -convert big_endian +FFLAGS = $(FORMAT_FREE) -convert big_endian +F77FLAGS = $(FORMAT_FIXED) -convert big_endian +FORMAT_FREE = -FR +FORMAT_FIXED = -FI FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = -L$(MPI_ROOT)/lib -lmpi @@ -329,8 +361,10 @@ DM_CC = mpcc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -FR -convert big_endian -F77FLAGS = -FI -convert big_endian +FFLAGS = $(FORMAT_FREE) -convert big_endian +F77FLAGS = $(FORMAT_FIXED) -convert big_endian +FORMAT_FREE = -FR +FORMAT_FIXED = -FI FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -353,8 +387,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -Mfree -byteswapio -O2 -F77FLAGS = -Mfixed -byteswapio -O2 +FFLAGS = $(FORMAT_FREE) -byteswapio -O2 +F77FLAGS = $(FORMAT_FIXED) -byteswapio -O2 +FORMAT_FREE = -Mfree +FORMAT_FIXED = -Mfixed FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = -g @@ -378,8 +414,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -Mfree -byteswapio -O2 -F77FLAGS = -Mfixed -byteswapio -O2 +FFLAGS = $(FORMAT_FREE) -byteswapio -O2 +F77FLAGS = $(FORMAT_FIXED) -byteswapio -O2 +FORMAT_FREE = -Mfree +FORMAT_FIXED = -Mfixed FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = -g @@ -403,8 +441,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -FR -convert big_endian -F77FLAGS = -FI -convert big_endian +FFLAGS = $(FORMAT_FREE) -convert big_endian +F77FLAGS = $(FORMAT_FIXED) -convert big_endian +FORMAT_FREE = -FR +FORMAT_FIXED = -FI FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -427,8 +467,10 @@ DM_CC = mpicc -cc=gcc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -ffree-form -g -fendian=big -F77FLAGS = -ffixed-form -g -fendian=big +FFLAGS = $(FORMAT_FREE) -g -fendian=big +F77FLAGS = $(FORMAT_FIXED) -g -fendian=big +FORMAT_FREE = -ffree-form +FORMAT_FIXED = -ffixed-form FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = -g @@ -452,8 +494,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4 -F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4 +FFLAGS = $(FORMAT_FREE) -O -fconvert=big-endian -frecord-marker=4 +F77FLAGS = $(FORMAT_FIXED) -O -fconvert=big-endian -frecord-marker=4 +FORMAT_FREE = -ffree-form +FORMAT_FIXED = -ffixed-form FCCOMPAT = CONFIGURE_COMPAT_FLAGS FCSUFFIX = FNGFLAGS = $(FFLAGS) @@ -478,8 +522,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4 -F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4 +FFLAGS = $(FORMAT_FREE) -O -fconvert=big-endian -frecord-marker=4 +F77FLAGS = $(FORMAT_FIXED) -O -fconvert=big-endian -frecord-marker=4 +FORMAT_FREE = -ffree-form +FORMAT_FIXED = -ffixed-form FCCOMPAT = CONFIGURE_COMPAT_FLAGS FCSUFFIX = FNGFLAGS = $(FFLAGS) @@ -509,8 +555,10 @@ DM_CC = mpicc -cc=$(SCC) FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -qfree -F77FLAGS = -qfixed +FFLAGS = $(FORMAT_FREE) +F77FLAGS = $(FORMAT_FIXED) +FORMAT_FREE = -qfree +FORMAT_FIXED = -qfixed FCSUFFIX = FNGFLAGS = $(FFLAGS) -qextname LDFLAGS = -Wl,-stack_size,10000000,-stack_addr,0xc000000 @@ -535,8 +583,10 @@ SFC = xlf90_r SCC = gcc-3.3 DM_FC = mpif90 -f90=$(SFC) DM_CC = mpicc -cc=$(SCC) -FFLAGS = -qfree -F77FLAGS = -qfixed +FFLAGS = $(FORMAT_FREE) +F77FLAGS = $(FORMAT_FIXED) +FORMAT_FREE = -qfree +FORMAT_FIXED = -qfixed FNGFLAGS = $(FFLAGS) -qextname LDFLAGS = -Wl,-stack_size,10000000,-stack_addr,0xc0000000 -L/usr/lib -lSystemStubs FC = CONFIGURE_FC @@ -559,8 +609,10 @@ DM_CC = mpicc -cc=gcc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -ffree-form -g -fno-second-underscore -F77FLAGS = -ffixed-form -g -fno-second-underscore +FFLAGS = $(FORMAT_FREE) -g -fno-second-underscore +F77FLAGS = $(FORMAT_FIXED) -g -fno-second-underscore +FORMAT_FREE = -ffree-form +FORMAT_FIXED = -ffixed-form FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = -g @@ -572,7 +624,7 @@ RANLIB = ranlib CC_TOOLS = ######################################################################################################################## -#ARCH AIX # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 +#ARCH AIX something # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 # COMPRESSION_LIBS = CONFIGURE_COMP_L COMPRESSION_INC = CONFIGURE_COMP_I @@ -588,8 +640,10 @@ FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) AR = ar -FFLAGS = -qfree=f90 -F77FLAGS = -qfixed +FFLAGS = $(FORMAT_FREE) +F77FLAGS = $(FORMAT_FIXED) +FORMAT_FREE = -qfree=f90 +FORMAT_FIXED = -qfixed FCSUFFIX = -qsuffix=f=f90 FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -611,8 +665,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_FC LD = $(FC) -FFLAGS = -free -convert big_endian -F77FLAGS = -convert big_endian +FFLAGS = $(FORMAT_FREE) -convert big_endian +F77FLAGS = $(FORMAT_FIXED) -convert big_endian +FORMAT_FREE = -free +FORMAT_FIXED = FNGFLAGS = $(FFLAGS) LDFLAGS = CFLAGS = @@ -633,8 +689,10 @@ DM_CC = mpicc -cc=$(SCC) FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -ffree-form -g -fno-second-underscore -F77FLAGS = -ffixed-form -g -fno-second-underscore +FFLAGS = $(FORMAT_FREE) -g -fno-second-underscore +F77FLAGS = $(FORMAT_FIXED) -g -fno-second-underscore +FORMAT_FREE = -ffree-form +FORMAT_FIXED = -ffixed-form FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = -g @@ -663,8 +721,10 @@ DM_CC = pgcc -Mmpi=msmpi FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -Mfree -g -F77FLAGS = -Mfixed -g +FFLAGS = $(FORMAT_FREE) -g +F77FLAGS = $(FORMAT_FIXED) -g +FORMAT_FREE = -Mfree +FORMAT_FIXED = -Mfixed FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = -g @@ -686,8 +746,10 @@ DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -freeform -64 -F77FLAGS = -64 +FFLAGS = $(FORMAT_FREE) -64 +F77FLAGS = $(FORMAT_FIXED) -64 +FORMAT_FREE = -freeform +FORMAT_FIXED = FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = -64 @@ -716,8 +778,10 @@ DM_CC = icc -lmpi FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -FR -convert big_endian -F77FLAGS = -FI -convert big_endian +FFLAGS = $(FORMAT_FREE) -convert big_endian +F77FLAGS = $(FORMAT_FIXED) -convert big_endian +FORMAT_FREE = -FR +FORMAT_FIXED = -FI FCSUFFIX = FNGFLAGS = LDFLAGS = @@ -740,8 +804,10 @@ DM_CC = FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -free -F77FLAGS = +FFLAGS = $(FORMAT_FREE) +F77FLAGS = $(FORMAT_FIXED) +FORMAT_FREE = -free +FORMAT_FIXED = FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -763,8 +829,10 @@ DM_CC = cc FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -N255 -f free -h byteswapio -F77FLAGS = -N255 -f fixed -h byteswapio +FFLAGS = $(FORMAT_FREE) -N255 -h byteswapio +F77FLAGS = $(FORMAT_FIXED) -N255 -h byteswapio +FORMAT_FREE = -f free +FORMAT_FIXED = -f fixed FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -787,8 +855,10 @@ DM_CC = $(SCC) FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) -FFLAGS = -FR -convert big_endian -F77FLAGS = -FI -convert big_endian +FFLAGS = $(FORMAT_FREE) -convert big_endian +F77FLAGS = $(FORMAT_FIXED) -convert big_endian +FORMAT_FREE = -FR +FORMAT_FIXED = -FI FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -821,8 +891,10 @@ CC_TOOLS = #TRADFLAG = #CPP = #AR = -#FFLAGS = -#F77FLAGS = +#FFLAGS = $(FORMAT_FREE) +#F77FLAGS = $(FORMAT_FIXED) +FORMAT_FREE = +FORMAT_FIXED = #FCSUFFIX = #FNGFLAGS = #LDFLAGS = diff --git a/arch/configure_reader.py b/arch/configure_reader.py new file mode 100755 index 000000000..45f3ae70e --- /dev/null +++ b/arch/configure_reader.py @@ -0,0 +1,334 @@ +#!/usr/bin/env python3 + +import sys +import re +import inspect +import platform + +archBlock = re.compile( r"(?:#[ ]*)(ARCH(?:.*\n)*?)(?:#{5,})", re.I ) +kvPair = re.compile( r"^(\w+)(?:[ \t]*=[ \t]*)(.*?)$", re.I | re.M ) +# Make this gnarly and complicated since configure.defaults has no standard formatting +# v start v OS V typical v MACOS +osAndArch = re.compile( r"^ARCH[ ]+(\w+)[ ]+((?:\w+.*?),|(?:[(].*?[)]))", re.I ) +# Just grab the first two words, thats what you get +osAndArchAlt = re.compile( r"^ARCH[ ]+(\w+)[ ]+(\w+)", re.I ) + +referenceVar = re.compile( r"[$][(](\w+)[)]", re.I ) + +class Stanza(): + + def __init__( self, lines ) : + self.lines_ = lines + self.os_ = None + self.archs_ = [] + self.kvPairs_ = {} + + def parse( self ) : + # First get os & archs + osarchMatch = osAndArch.match( self.lines_ ) + + if osarchMatch is None : + osarchMatch = osAndArchAlt.match( self.lines_ ) + if osarchMatch is None : + print( "Could not find OS and architecture info in " + self.lines_.partition("\n")[0] ) + + self.os_ = osarchMatch.group(1) + self.archs_ = osarchMatch.group(2).strip(",").split( " " ) + + for kvPairMatch in kvPair.finditer( self.lines_ ) : + self.kvPairs_[ kvPairMatch.group(1) ] = kvPairMatch.group(2) + self.removeComments( kvPairMatch.group(1) ) + + # Now sanitize + self.sanitize() + + def dereference( self, field, fatal=False ) : + if field in self.kvPairs_ : + prevField = self.kvPairs_[field] + + for refVarIter in referenceVar.finditer( prevField ) : + if refVarIter is not None : + # Grab group 1 and check that it is in our kv pairs + refVar = refVarIter.group(1) + if refVar not in self.kvPairs_ : + if fatal : + print( "Could not rereference : " + refVar ) + exit(1) + else: + continue + + # Recursively deref + self.dereference( refVar, fatal ) + + # Replace in original + self.kvPairs_[field] = self.kvPairs_[field].replace( + "$({var})".format( var=refVar ), + self.kvPairs_[refVar] + ) + + def removeReferences( self, field, specifics=[] ) : + if field in self.kvPairs_ : + if specifics : + for specific in specifics : + self.kvPairs_[ field ] = self.kvPairs_[ field ].replace( + "$({var})".format( var=specific ), + "" + ) + else : + self.kvPairs_[ field ] = referenceVar.sub( "", self.kvPairs_[ field ] ) + + + def removeComments( self, field ) : + if field in self.kvPairs_ : + self.kvPairs_[ field ] = self.kvPairs_[ field ].split( "#", 1 )[0] + + def splitIntoFieldAndFlags( self, field ) : + # Fix flags being mixed with programs + if field in self.kvPairs_ : + fieldValue = self.kvPairs_[ field ] + + self.kvPairs_[field] = fieldValue.partition(" ")[0] + self.kvPairs_[field + "_FLAGS"] = fieldValue.partition(" ")[1] + + def sanitize( self ) : + # Fix problematic variables + self.dereference( "DM_FC" ) + self.dereference( "DM_CC" ) + # self.removeReferences( "FCBASEOPTS_NO_G" ) + # Get rid of all these mixed up flags, these are handled by cmake natively or + # just in the wrong place + self.removeReferences( "FFLAGS", [ "FORMAT_FREE", "FORMAT_FIXED" ] ) + self.removeReferences( "F77FLAGS", [ "FORMAT_FREE", "FORMAT_FIXED" ] ) + # # Now deref + # self.dereference( "FCBASEOPTS" ) + + # Now fix certain ones that are mixing programs with flags all mashed into one option + self.splitIntoFieldAndFlags( "DM_FC" ) + self.splitIntoFieldAndFlags( "DM_CC" ) + self.splitIntoFieldAndFlags( "M4" ) + + # Remove rogue compile commands that should *NOT* even be here + keysToSanitize = [ + "COMPRESSION_LIBS", + "COMPRESSION_INC", + "FDEFS", + "SFC", + "SCC", + "DM_FC", + "DM_CC", + "FC", + "CC", + "LD", + "FFLAGS", + "F77FLAGS", + "FORMAT_FREE", + "FORMAT_FIXED", + "FCSUFFIX", + "FNGFLAGS", + "LDFLAGS", + "CFLAGS", + "CPP", + "CPPFLAGS", + "ARFLAGS" + ] + + for keyToSan in keysToSanitize : + if keyToSan in self.kvPairs_ : + self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMP_L", "" ) + self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMP_I", "" ) + self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_FC", "" ) + self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_CC", "" ) + self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_FDEFS", "" ) + self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_MPI", "" ) + self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMPAT_FLAGS", "" ) + + # Now deref all the rest + for key in self.kvPairs_ : + self.dereference( key ) + # And for final measure strip + self.kvPairs_[ key ] = self.kvPairs_[ key ].strip() + + def __str__( self ): + # base = """OS {os:<8} ARCHITECTURES {archs:<20} + # >> SFC = {SFC:<12} + # >> SCC = {SCC:<12} + # >> CCOMP = {CCOMP:<12} + # >> DM_FC = {DM_FC:<12} + # >> DM_CC = {DM_CC:<12} + # """ + # print( self.kvPairs_ ) + base = """{rec} {os:<10} {SFC:<11} / {SCC:<11} / {DM_FC:<11} / {DM_CC:<11}""" + text = inspect.cleandoc( base ).format( + os=str(self.os_), + rec=( "!!" if platform.system().lower() != self.os_.lower() else "Ok" ), + # archs=str(self.archs_), + SFC=str( self.kvPairs_["SFC"].partition(" ")[0] ), + SCC=str( self.kvPairs_["SCC"].partition(" ")[0] ), + # CCOMP=str( self.kvPairs_["CCOMP"].partition(" ")[0] ), + DM_FC=str( self.kvPairs_["DM_FC"].partition(" ")[0] ), + DM_CC=str( self.kvPairs_["DM_CC"].partition(" ")[0] ) + ) + # text += "\n" + "\n".join( [ "{key:<18} = {value}".format( key=key, value=value) for key, value in self.kvPairs_.items() ] ) + return text + + @staticmethod + def findFirstDifference( rhStanza, lhStanza, maxLength=32 ) : + diff = False + value = "" + valuesToCheck = [ + "ARCH_LOCAL", + "BYTESWAPIO", + "CFLAGS_LOCAL", + "CFLAGS", + "FFLAGS", + "DM_CC", + "DM_FC", + "DM_FC_FLAGS", + "DM_CC_FLAGS", + "FCBASEOPTS", + "FCDEBUG", + "FCNOOPT", + "FCOPTIM", + "M4_FLAGS", + "SCC", + "SFC" + ] + for rhKey, rhValue in rhStanza.kvPairs_.items() : + if rhKey in valuesToCheck and rhKey in lhStanza.kvPairs_ : + # Qualifies for difference + if rhValue != lhStanza.kvPairs_[rhKey] : + diff = True + value = "{key:<12} = {value}".format( key=rhKey, value=lhStanza.kvPairs_[rhKey] ) + + # Truncate + value = ( value[:maxLength] + "..." ) if len( value ) > maxLength else value + + return diff, value + + +def getStringOptionSelection( topLevelCmake, searchString ) : + topLevelCmakeFP = open( topLevelCmake, "r" ) + topLevelCmakeLines = topLevelCmakeFP.read() + topLevelCmakeFP.close() + + stringOptionsMatch = re.search( + r"set\s*[(]\s*" + searchString + r"\s*(.*?)[)]", + topLevelCmakeLines, + re.I | re.S | re.M + ) + if stringOptionsMatch is None : + print( "Syntax error in parsing " + searchString + " from " + topLevelCmake ) + exit(1) + + options = [ option.split( "#", 1 )[0].strip() for option in stringOptionsMatch.group(1).split( "\n" ) ] + # Weed out empties + options = [ option for option in options if option ] + + optionsFmt = ", ".join( [ "{idx} : {opt}".format( idx=options.index( opt ), opt=opt ) for opt in options ] ) + selection = int( input( "Select string options [0-{max}] ({opts}) : ".format( max=len(options)-1, opts=optionsFmt ) ) ) + + if selection < 0 or selection > len(options) : + print( "Invalid option selection for " + searchString + "!" ) + exit(1) + + return options[selection] + +def generateCMakeToolChainFile( cmakeToolChainTemplate, output, stanza, optionsDict={} ) : + cmakeToolChainTemplateFP = open( cmakeToolChainTemplate, "r" ) + cmakeToolChainTemplateLines = cmakeToolChainTemplateFP.read() + cmakeToolChainTemplateFP.close() + + configStanza = cmakeToolChainTemplateLines.format( + CPPFLAGS=stanza.kvPairs_["CPPFLAGS"], + # BYTESWAPIO=stanza.kvPairs_["BYTESWAPIO"], + CFLAGS=stanza.kvPairs_["CFLAGS"], + FFLAGS=stanza.kvPairs_["FFLAGS"], + DM_CC=stanza.kvPairs_["DM_CC"], + DM_FC=stanza.kvPairs_["DM_FC"], + DM_FC_FLAGS=stanza.kvPairs_["DM_FC_FLAGS"], + DM_CC_FLAGS=stanza.kvPairs_["DM_CC_FLAGS"], + # FCBASEOPTS=stanza.kvPairs_["FCBASEOPTS"], + # FCDEBUG=stanza.kvPairs_["FCDEBUG"], + # FCNOOPT=stanza.kvPairs_["FCNOOPT"], + # FCOPTIM=stanza.kvPairs_["FCOPTIM"], + # M4_FLAGS=stanza.kvPairs_["M4_FLAGS"], + SCC=stanza.kvPairs_["SCC"], + SFC=stanza.kvPairs_["SFC"] + ) + + # Extra stufff not from stanza but options + fmtOption = "set( {opt:<32} {value:<12} CACHE STRING \"Set by configuration\" FORCE )" + configStanza += "\n" + "\n".join( [ fmtOption.format( opt=key, value=value ) for key, value in optionsDict.items() ] ) + + outputFP = open( output, "w" ) + outputFP.write( configStanza ) + outputFP.close() + +def main() : + configFile = sys.argv[1] + cmakeTemplateFile = sys.argv[2] + cmakeConfigFile = sys.argv[3] + cmakeFile = sys.argv[4] + + # coreOption = getStringOptionSelection( cmakeFile, "WRF_CORE_OPTIONS" ) + # nestingOption = getStringOptionSelection( cmakeFile, "WRF_NESTING_OPTIONS" ) + # caseOption = getStringOptionSelection( cmakeFile, "WRF_CASE_OPTIONS" ) + + # These are yes + yesValues = [ "yes", "y", "true", "1" ] + + #!TODO Expand this for all wrf options + useMPI = input( "[DM] Use MPI? [Y/n] : " ).lower() in yesValues + useOpenMP = input( "[SM] Use OpenMP? [Y/n] : " ).lower() in yesValues + buildExt = input( "[EXT] Build external? [Y/n] : " ).lower() in yesValues + + + fp = open( configFile, 'r' ) + lines = fp.read() + fp.close() + + # Now grab the blocks and parse + stanzas = [] + uniqueConfigs = {} + stanzaIdx = 0 + for stanzaBlock in archBlock.finditer( lines ) : + stanza = Stanza( stanzaBlock.group(1) ) + stanza.parse() + + stanzas.append( stanza ) + stanzaConfig = str( stanza ) + stanzaId = "{idx:<3} ".format( idx=stanzaIdx ) + if stanzaConfig not in uniqueConfigs : + uniqueConfigs[ stanzaConfig ] = { "stanza" : stanza, "idx" : stanzaIdx } + print( stanzaId + stanzaConfig + "[first entry]" ) + else : + diff, value = Stanza.findFirstDifference( uniqueConfigs[ stanzaConfig ]["stanza"], stanza ) + if diff : + print( stanzaId + stanzaConfig + "@{idx} diff => {value}".format( idx=uniqueConfigs[ stanzaConfig ][ "idx" ], value=value ) ) + else : + print( stanzaId + stanzaConfig + "[no difference]" ) + stanzaIdx += 1 + + print( "!! - Not recommended for your system" ) + + idxSelection = int( input( "Select configuration [0-{stop}] (note !!) : ".format( stop=( stanzaIdx-1) ) ) ) + if idxSelection < 0 or idxSelection > stanzaIdx - 1 : + print( "Invalid configuration selection!" ) + exit(1) + + additionalOptions = { + # "WRF_CORE" : coreOption, + # "WRF_NESTING" : nestingOption, + # "WRF_CASE" : caseOption, + "USE_OPENMP" : "ON" if useOpenMP else "OFF", + "USE_MPI" : "ON" if useMPI else "OFF", + "BUILD_EXTERNALS" : "ON" if buildExt else "OFF" + } + generateCMakeToolChainFile( cmakeTemplateFile, cmakeConfigFile, stanzas[idxSelection], additionalOptions ) + + + + +if __name__ == '__main__' : + main() + From 9d04b0fc62e87591ba92c7acf82e1ef395f13f29 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 28 Jun 2023 17:31:48 -0600 Subject: [PATCH 09/63] Ignoring build files --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7e1532183..3979058db 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ ungrib.exe metgrid.exe configure.wps configure.wps.backup - +wps_config.cmake +run/ +*.log +_build/ # Compiled GRIB2 libraries if --build-grib2-libs option is given to configure script grib2 From 12dbe0f129cdbbb15e2704bfa392ddd88a4bd4d5 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 28 Jun 2023 17:32:34 -0600 Subject: [PATCH 10/63] ungrib build --- ungrib/CMakeLists.txt | 96 ++++++++++++++++++++++++++++++++ ungrib/src/CMakeLists.txt | 64 +++++++++++++++++++++ ungrib/src/ngl/CMakeLists.txt | 2 + ungrib/src/ngl/g2/CMakeLists.txt | 91 ++++++++++++++++++++++++++++++ ungrib/src/ngl/w3/CMakeLists.txt | 92 ++++++++++++++++++++++++++++++ 5 files changed, 345 insertions(+) create mode 100644 ungrib/CMakeLists.txt create mode 100644 ungrib/src/CMakeLists.txt create mode 100644 ungrib/src/ngl/CMakeLists.txt create mode 100644 ungrib/src/ngl/g2/CMakeLists.txt create mode 100644 ungrib/src/ngl/w3/CMakeLists.txt diff --git a/ungrib/CMakeLists.txt b/ungrib/CMakeLists.txt new file mode 100644 index 000000000..e6711e201 --- /dev/null +++ b/ungrib/CMakeLists.txt @@ -0,0 +1,96 @@ +add_executable( ungrib ) +add_executable( g1print ) +add_executable( g2print ) +add_library ( pgu ) + +add_subdirectory( src ) + +set_target_properties( + pgu + PROPERTIES + # Just dump everything in here + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_FORMAT FREE + ) + +set_target_properties( + ungrib + PROPERTIES + # Just dump everything in here + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_FORMAT FREE + ) + +set_target_properties( + g1print + PROPERTIES + # Just dump everything in here + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_FORMAT FREE + ) + +set_target_properties( + g2print + PROPERTIES + # Just dump everything in here + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_FORMAT FREE + ) + +# Control dependencies and linking +target_link_libraries( + ungrib + PRIVATE + w3 + g2 + pgu + Jasper::Jasper + PNG::PNG + ZLIB::ZLIB + ) + +target_link_libraries( + g1print + PRIVATE + pgu + ) + +target_link_libraries( + g2print + PRIVATE + w3 + g2 + Jasper::Jasper + PNG::PNG + ZLIB::ZLIB + pgu + ) + + +target_include_directories( + ungrib + PRIVATE + $ + $ + ) + + +target_include_directories( + g2print + PRIVATE + $ + $ + ) +# $<$:$> +# $<$:$> +# ${netCDF_INCLUDE_DIRS} + + +# Add these to the export targets +install( + TARGETS ungrib g1print g2print pgu + EXPORT ${EXPORT_NAME}Targets + RUNTIME DESTINATION bin/ + ARCHIVE DESTINATION lib/ + LIBRARY DESTINATION lib/ + ) diff --git a/ungrib/src/CMakeLists.txt b/ungrib/src/CMakeLists.txt new file mode 100644 index 000000000..6333bd8e4 --- /dev/null +++ b/ungrib/src/CMakeLists.txt @@ -0,0 +1,64 @@ +add_subdirectory( ngl ) + + +# Special cases, maybe one day these will get fixed +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/rd_grib2.F + TARGET_DIRECTORY ungrib + PROPERTIES + Fortran_FORMAT FIXED + ) + +target_sources( + pgu + PRIVATE + build_hdate.F + geth_newdate.F + geth_idts.F + swap.F + table.F + module_stringutil.F + parse_table.F + gbytesys.F + gribcode.F + read_namelist.F + cio.c + module_debug.F + misc_definitions_module.F + ) + +target_sources( + ungrib + PRIVATE + debug_cio.c + module_stringutil.F + table.F + module_datarray.F + gridinfo.F + new_storage.F + filelist.F + ungrib.F + output.F + rrpr.F + rd_grib1.F + file_delete.F + datint.F + rd_grib2.F + ) + +target_sources( + g1print + PRIVATE + g1print.F + gribcode.F + module_debug.F + debug_cio.c + ) + +target_sources( + g2print + PRIVATE + filelist.F + gridinfo.F + g2print.F + ) diff --git a/ungrib/src/ngl/CMakeLists.txt b/ungrib/src/ngl/CMakeLists.txt new file mode 100644 index 000000000..de91c34c4 --- /dev/null +++ b/ungrib/src/ngl/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory( w3 ) +add_subdirectory( g2 ) \ No newline at end of file diff --git a/ungrib/src/ngl/g2/CMakeLists.txt b/ungrib/src/ngl/g2/CMakeLists.txt new file mode 100644 index 000000000..3dc642e53 --- /dev/null +++ b/ungrib/src/ngl/g2/CMakeLists.txt @@ -0,0 +1,91 @@ +get_filename_component( FOLDER_COMPILE_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME ) + +add_library( ${FOLDER_COMPILE_TARGET} STATIC ) + +set_target_properties( + ${FOLDER_COMPILE_TARGET} + PROPERTIES + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${FOLDER_COMPILE_TARGET} + # Fortran_FORMAT FREE + ) + +target_compile_definitions( + ${FOLDER_COMPILE_TARGET} + PRIVATE + __64BIT__ + ) +# target_link_libraries( ${FOLDER_COMPILE_TARGET} +# PRIVATE +# ${netCDF_LIBRARIES} +# $<$:$> +# $<$:$> +# $ +# ) + +target_sources( + ${FOLDER_COMPILE_TARGET} + PRIVATE + gridtemplates.f + pdstemplates.f + drstemplates.f + gribmod.f + realloc.f + intmath.f + addfield.F + addgrid.f + addlocal.f + getfield.f + gb_info.f + gf_getfld.f + gf_free.f + gf_unpack1.f + gf_unpack2.f + gf_unpack3.f + gf_unpack4.f + gf_unpack5.f + gf_unpack6.f + gf_unpack7.F + gettemplates.f + getlocal.f + getdim.f + getpoly.f + gribcreate.f + gribend.f + gribinfo.f + mkieee.f + rdieee.f + simunpack.f + reduce.f + comunpack.f + specunpack.f + jpcunpack.F + dec_jpeg2000.c + pngunpack.F + dec_png.c + gbytesc.f + skgb.f + ixgb2.f + getidx.f + getg2i.f + getg2ir.f + getgb2s.f + getgb2r.f + getgb2l.f + getgb2.f + getgb2p.f + getgb2rp.f + putgb2.f + g2grids.f + gdt2gds.f + params.f + params_ecmwf.f + mova2i.c + ) + +install( + TARGETS ${FOLDER_COMPILE_TARGET} + EXPORT ${EXPORT_NAME}Targets + RUNTIME DESTINATION bin/ + ARCHIVE DESTINATION lib/ + LIBRARY DESTINATION lib/ + ) diff --git a/ungrib/src/ngl/w3/CMakeLists.txt b/ungrib/src/ngl/w3/CMakeLists.txt new file mode 100644 index 000000000..f5c8b18fd --- /dev/null +++ b/ungrib/src/ngl/w3/CMakeLists.txt @@ -0,0 +1,92 @@ +get_filename_component( FOLDER_COMPILE_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME ) + +add_library( ${FOLDER_COMPILE_TARGET} STATIC ) + +set_target_properties( + ${FOLDER_COMPILE_TARGET} + PROPERTIES + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${FOLDER_COMPILE_TARGET} + # Fortran_FORMAT FREE + ) +target_sources( + ${FOLDER_COMPILE_TARGET} + PRIVATE + getgb.f + getgbmh.f + putgbex.f + w3fi73.f + getgb1r.f + getgbmp.f + putgbn.f + w3fi74.f + getgb1re.f + getgbp.f + r63w72.f + w3fi75.f + getgb1s.f + getgi.f + sbyte.f + w3fi76.f + getgbe.f + getgir.f + sbytes.f + w3fi82.f + getgbeh.f + idsdef.f + w3fi83.f + getgbem.f + iw3jdn.f + w3difdat.f + w3fs26.f + getgbemh.f + ixgb.f + w3doxdat.f + w3log.f + getgbemp.f + lengds.f + w3fi01.f + w3movdat.f + getgbens.f + pdsens.f + w3fi58.f + w3reddat.f + getgbep.f + pdseup.f + w3fi59.f + w3tagb.f + errmsg.f + getgbex.f + putgb.f + w3fi63.f + gbytes.f + getgbexm.f + putgbe.f + w3fi68.f + gbytes_char.f + getgbh.f + putgben.f + getbit.f + getgbm.f + putgbens.f + w3fi72.f + fparsei.f + fparser.f + instrument.f + start.f + summary.f + w3utcdat.f + w3fs21.f + w3locdat.f + w3fi71.f + baciof.f + bacio.v1.3.c + errexit.c + ) + +install( + TARGETS ${FOLDER_COMPILE_TARGET} + EXPORT ${EXPORT_NAME}Targets + RUNTIME DESTINATION bin/ + ARCHIVE DESTINATION lib/ + LIBRARY DESTINATION lib/ + ) From dcc43fbc020fce0403d0d54b8713c8c0f299df2b Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 28 Jun 2023 17:34:12 -0600 Subject: [PATCH 11/63] Cleaning script --- cleanCMake.sh | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 cleanCMake.sh diff --git a/cleanCMake.sh b/cleanCMake.sh new file mode 100755 index 000000000..d6ab05299 --- /dev/null +++ b/cleanCMake.sh @@ -0,0 +1,69 @@ +#!/bin/bash +BUILD_DIR=_build +INSTALL_DIR=run +TEST_DIR=test/ + +function help() +{ + echo "./cleanCMake.sh [options]" + echo " -c Basic cmake clean functionality [cmake --build ${BUILD_DIR} -j 1 --target clean]" + echo " -i Remove cmake binary installs [xargs rm < ${BUILD_DIR}/install_manifest.txt]" + # echo " -l Remove symlinks (WPS) [ find ${TEST_DIR} -type l -exec rm {} \; ]" + echo " -f Remove build & install folders (WPS) [ rm ${BUILD_DIR} -r; rm ${INSTALL_DIR}/ -r ]" + echo " -a Remove all (WPS), equivalent to -f (more specifically -c -i -f)" +} + +CLEAN_BASIC_BUILD=FALSE +CLEAN_BASIC_INSTALL=FALSE +CLEAN_LINKS=FALSE +CLEAN_FOLDERS=FALSE +CLEAN_ALL=FALSE + +while getopts "hcilfa" opt; do + case ${opt} in + c) + CLEAN_BASIC_BUILD=TRUE + ;; + i) + CLEAN_BASIC_INSTALL=TRUE + ;; + l) + CLEAN_LINKS=TRUE + ;; + f) + CLEAN_FOLDERS=TRUE + ;; + a) + CLEAN_ALL=TRUE + ;; + h) help; exit 0 ;; + *) help; exit 1 ;; + :) help; exit 1 ;; + \?) help; exit 1 ;; + esac +done + +if [[ $OPTIND -eq 1 ]]; then + # Do basic clean I guess + CLEAN_BASIC_BUILD=TRUE +fi + +if [[ "${CLEAN_BASIC_BUILD}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then + echo "Doing cmake make clean" + cmake --build ${BUILD_DIR} -j 1 --target clean +fi + +if [[ "${CLEAN_BASIC_INSTALL}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then + echo "Removing binary installs" + xargs rm < ${BUILD_DIR}/install_manifest.txt +fi + +# if [[ "${CLEAN_LINKS}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then +# echo "Removing all symlinks in ${TEST_DIR}" +# find ${TEST_DIR} -type l -exec rm {} \; +# fi + +if [[ "${CLEAN_FOLDERS}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then + echo "Deleting ${BUILD_DIR} & ${INSTALL_DIR}/" + rm ${BUILD_DIR} -r; rm ${INSTALL_DIR}/ -r +fi \ No newline at end of file From 8762e6f8d1aa1a6a6c3c606ecf39b472f1612c3c Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 28 Jun 2023 17:34:41 -0600 Subject: [PATCH 12/63] externals build --- external/CMakeLists.txt | 149 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 external/CMakeLists.txt diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt new file mode 100644 index 000000000..c3f031eba --- /dev/null +++ b/external/CMakeLists.txt @@ -0,0 +1,149 @@ +message( STATUS "Building external libraries. This may take awhile..." ) +list(APPEND CMAKE_MESSAGE_INDENT " ") +# Set up basic environment variables + +set( ENV{CC} ${CMAKE_C_COMPILER} ) +set( ENV{CXX} ${CMAKE_CXX_COMPILER} ) +set( ENV{FC} ${CMAKE_Fortran_COMPILER} ) +set( ENV{FCFLAGS} ${CMAKE_Fortran_FLAGS} ) +# set( ENV{F77} gfortran ) +set( ENV{FFLAGS} ${CMAKE_Fortran_FLAGS} ) +# set( ENV{LDFLAGS} -L$DIR/grib2/lib ) +# set( ENV{CPPFLAGS} -I$DIR/grib2/include ) + +################################################################################ +## +## ZLib +## +################################################################################ +set( TARGET_FOLDER zlib-1.2.11 ) +set( TAG_FILE ${INTERNAL_GRIB2_PATH}/include/zlib.h ) +if ( NOT EXISTS "${TAG_FILE}" ) + set( LOG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-configure.log ) + message( STATUS "Configuring ${TARGET_FOLDER}...") + execute_process( + COMMAND + ./configure --prefix=${INTERNAL_GRIB2_PATH} --static + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER} + OUTPUT_FILE ${LOG_FILE} + ERROR_FILE ${LOG_FILE} + # COMMAND_ECHO STDOUT + RESULT_VARIABLE ${TARGET_FOLDER}_STATUS_CONF + ) + if ( ${TARGET_FOLDER}_STATUS_CONF AND NOT ${TARGET_FOLDER}_STATUS_CONF EQUAL 0 ) + message( FATAL_ERROR "Failed to configure ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" ) + else() + message( STATUS "Finished configuring ${TARGET_FOLDER}" ) + endif() + + set( LOG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-build.log ) + message( STATUS "Building ${TARGET_FOLDER}...") + execute_process( + COMMAND + make install + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER} + OUTPUT_FILE ${LOG_FILE} + ERROR_FILE ${LOG_FILE} + # COMMAND_ECHO STDOUT + RESULT_VARIABLE ${TARGET_FOLDER}_STATUS + ) + if ( ${TARGET_FOLDER}_STATUS AND NOT ${TARGET_FOLDER}_STATUS EQUAL 0 AND NOT EXISTS "${TAG_FILE}" ) + message( FATAL_ERROR "Failed to build ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" ) + else() + message( STATUS "Finished building ${TARGET_FOLDER}" ) + endif() +else() + message( STATUS "External ${TARGET_FOLDER} already built, skipping" ) +endif() + +################################################################################ +## +## libPNG +## +################################################################################ +set( TARGET_FOLDER libpng-1.6.37 ) +set( TAG_FILE ${INTERNAL_GRIB2_PATH}/include/png.h ) +if ( NOT EXISTS "${TAG_FILE}" ) + set( LOG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-configure.log ) + message( STATUS "Configuring ${TARGET_FOLDER}...") + execute_process( + COMMAND + ./configure --prefix=${INTERNAL_GRIB2_PATH} --disable-shared --with-zlib-prefix=${INTERNAL_GRIB2_PATH}/ + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER} + OUTPUT_FILE ${LOG_FILE} + ERROR_FILE ${LOG_FILE} + # COMMAND_ECHO STDOUT + RESULT_VARIABLE ${TARGET_FOLDER}_STATUS_CONF + ) + if ( ${TARGET_FOLDER}_STATUS_CONF AND NOT ${TARGET_FOLDER}_STATUS_CONF EQUAL 0 ) + message( FATAL_ERROR "Failed to configure ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" ) + else() + message( STATUS "Finished configuring ${TARGET_FOLDER}" ) + endif() + + set( LOG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-build.log ) + message( STATUS "Building ${TARGET_FOLDER}...") + execute_process( + COMMAND + make install + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER} + OUTPUT_FILE ${LOG_FILE} + ERROR_FILE ${LOG_FILE} + # COMMAND_ECHO STDOUT + RESULT_VARIABLE ${TARGET_FOLDER}_STATUS + ) + if ( ${TARGET_FOLDER}_STATUS AND NOT ${TARGET_FOLDER}_STATUS EQUAL 0 AND NOT EXISTS "${TAG_FILE}" ) + message( FATAL_ERROR "Failed to build ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" ) + else() + message( STATUS "Finished building ${TARGET_FOLDER}" ) + endif() +else() + message( STATUS "External ${TARGET_FOLDER} already built, skipping" ) +endif() + +################################################################################ +## +## Jasper +##!TODO This is "failing" due to automake-1.14 missing. Make this a clean build +## +################################################################################ +set( TARGET_FOLDER jasper-1.900.29 ) +set( TAG_FILE ${INTERNAL_GRIB2_PATH}/include/jasper/jasper.h ) +if ( NOT EXISTS "${TAG_FILE}" ) + set( LOG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-configure.log ) + message( STATUS "Configuring ${TARGET_FOLDER}...") + execute_process( + COMMAND + ./configure --prefix=${INTERNAL_GRIB2_PATH} --disable-shared + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER} + OUTPUT_FILE ${LOG_FILE} + ERROR_FILE ${LOG_FILE} + # COMMAND_ECHO STDOUT + RESULT_VARIABLE ${TARGET_FOLDER}_STATUS_CONF + ) + if ( ${TARGET_FOLDER}_STATUS_CONF AND NOT ${TARGET_FOLDER}_STATUS_CONF EQUAL 0 ) + message( FATAL_ERROR "Failed to configure ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" ) + else() + message( STATUS "Finished configuring ${TARGET_FOLDER}" ) + endif() + + set( LOG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-build.log ) + message( STATUS "Building ${TARGET_FOLDER}...") + execute_process( + COMMAND + make -r -i install + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER} + OUTPUT_FILE ${LOG_FILE} + ERROR_FILE ${LOG_FILE} + # COMMAND_ECHO STDOUT + RESULT_VARIABLE ${TARGET_FOLDER}_STATUS + ) + if ( ${TARGET_FOLDER}_STATUS AND NOT ${TARGET_FOLDER}_STATUS EQUAL 0 AND NOT EXISTS "${TAG_FILE}" ) + message( FATAL_ERROR "Failed to build ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" ) + else() + message( STATUS "Finished building ${TARGET_FOLDER}" ) + endif() +else() + message( STATUS "External ${TARGET_FOLDER} already built, skipping" ) +endif() +list(POP_BACK CMAKE_MESSAGE_INDENT) \ No newline at end of file From fcd3e3e85a1bd6b8705dee2970a532a16997b4cc Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 28 Jun 2023 17:36:44 -0600 Subject: [PATCH 13/63] Looks like there are some rogue generated files that aren't ignored --- external/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/external/.gitignore b/external/.gitignore index 59b9d3ba1..b9b5e1960 100644 --- a/external/.gitignore +++ b/external/.gitignore @@ -1,3 +1,4 @@ +jasper-1.900.29/autom4te.cache/ jasper-1.900.29/Makefile jasper-1.900.29/config.log jasper-1.900.29/config.status @@ -281,11 +282,14 @@ zlib-1.2.11/inffast.o zlib-1.2.11/inflate.o zlib-1.2.11/inftrees.o zlib-1.2.11/libz.a +zlib-1.2.11/Makefile zlib-1.2.11/minigzip zlib-1.2.11/minigzip.o zlib-1.2.11/minigzip64 zlib-1.2.11/minigzip64.o zlib-1.2.11/trees.o zlib-1.2.11/uncompr.o +zlib-1.2.11/zconf.h zlib-1.2.11/zlib.pc +zlib-1.2.11/ztest63255* zlib-1.2.11/zutil.o From 1dbee3acfeb63b57814e833e80256723edf58c4f Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 28 Jun 2023 17:37:16 -0600 Subject: [PATCH 14/63] Copying files from WRF build, unfortunately --- cmake/README | 6 +++ cmake/modules/FindJasper.cmake | 59 +++++++++++++++++++++++++ cmake/modules/FindnetCDF.cmake | 71 +++++++++++++++++++++++++++++++ cmake/template/WPSConfig.cmake.in | 20 +++++++++ cmake/template/arch_config.cmake | 20 +++++++++ cmake/wrf_get_version.cmake | 11 +++++ 6 files changed, 187 insertions(+) create mode 100644 cmake/README create mode 100644 cmake/modules/FindJasper.cmake create mode 100644 cmake/modules/FindnetCDF.cmake create mode 100644 cmake/template/WPSConfig.cmake.in create mode 100644 cmake/template/arch_config.cmake create mode 100644 cmake/wrf_get_version.cmake diff --git a/cmake/README b/cmake/README new file mode 100644 index 000000000..cd3ca6766 --- /dev/null +++ b/cmake/README @@ -0,0 +1,6 @@ +All files in this directory are currently clone-and-owned +from WRF/cmake (except for the project-specific config) + +!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!! +If you modify a file in here, you will need to modify the +respective original file in WRF \ No newline at end of file diff --git a/cmake/modules/FindJasper.cmake b/cmake/modules/FindJasper.cmake new file mode 100644 index 000000000..3b9bc6210 --- /dev/null +++ b/cmake/modules/FindJasper.cmake @@ -0,0 +1,59 @@ +# Find Jasper +# Eventually replace with Jasper's actual config if using that +# Once found this file will define: +# Jasper_FOUND - System has Jasper +# Jasper_INCLUDE_DIRS - The Jasper include directories +# Jasper_LIBRARIES - The libraries needed to use Jasper + +find_package( PkgConfig ) +pkg_check_modules( PC_Jasper QUIET Jasper ) +# set(CMAKE_FIND_DEBUG_MODE TRUE) +find_path( + Jasper_INCLUDE_DIR + NAMES jasper/jasper.h # Make it so we go up one dir + # Hints before PATHS + HINTS ${Jasper_ROOT} ${JASPERINC} ${JASPER_PATH} ENV Jasper_ROOT ENV JASPERINC ENV JASPER_PATH + PATHS ${PC_Jasper_INCLUDE_DIRS} + PATH_SUFFIXES Jasper jasper include #include/jasper + ) +find_library( + Jasper_LIBRARY + NAMES jasper + # Hints before PATHS + HINTS ${Jasper_ROOT} ${JASPERLIB} ${JASPER_PATH} ENV Jasper_ROOT ENV JASPERLIB ENV JASPER_PATH + PATHS ${PC_Jasper_LIBRARY_DIRS} + PATH_SUFFIXES lib + ) + +# set(CMAKE_FIND_DEBUG_MODE FALSE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Jasper + FOUND_VAR Jasper_FOUND + REQUIRED_VARS + Jasper_LIBRARY + Jasper_INCLUDE_DIR + # VERSION_VAR Jasper_VERSION + ) + +if ( Jasper_FOUND AND NOT TARGET Jasper::Jasper ) + add_library( Jasper::Jasper UNKNOWN IMPORTED ) + set_target_properties( + Jasper::Jasper + PROPERTIES + IMPORTED_LOCATION "${Jasper_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Jasper_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Jasper_INCLUDE_DIR}" + ) + + # Allow traditional/legacy style usage + set( Jasper_LIBRARIES ${Jasper_LIBRARY} ) + set( Jasper_INCLUDE_DIRS ${Jasper_INCLUDE_DIR} ) + set( Jasper_DEFINITIONS ${PC_Jasper_CFLAGS_OTHER} ) + + mark_as_advanced( + Jasper_INCLUDE_DIR + Jasper_LIBRARY + ) +endif() \ No newline at end of file diff --git a/cmake/modules/FindnetCDF.cmake b/cmake/modules/FindnetCDF.cmake new file mode 100644 index 000000000..f9051f079 --- /dev/null +++ b/cmake/modules/FindnetCDF.cmake @@ -0,0 +1,71 @@ +# Find netcdf +# Eventually replace with netCDF's actual config if using that +# Once found this file will define: +# netCDF_FOUND - System has netcdf +# netCDF_INCLUDE_DIRS - The netcdf include directories +# netCDF_LIBRARIES - The libraries needed to use netcdf +# netCDF_DEFINITIONS - Compiler switches required for using netcdf + +# list( REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} ) +# find_package( netCDF ) +# list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} ) + +# Use nc-config +find_program( + NETCDF_PROGRAM + nc-config + QUIET + ) + +if ( ${NETCDF_PROGRAM} MATCHES "-NOTFOUND$" ) + message( STATUS "No nc-config found" ) +else() + message( STATUS "Found NETCDF_PROGRAM : ${NETCDF_PROGRAM}" ) + + execute_process( COMMAND ${NETCDF_PROGRAM} --includedir OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_INCLUDE_DIR ) + execute_process( COMMAND ${NETCDF_PROGRAM} --libdir OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_LIBRARY_DIR ) + execute_process( COMMAND ${NETCDF_PROGRAM} --prefix OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_PREFIX ) + execute_process( COMMAND ${NETCDF_PROGRAM} --libs OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_CLIBS ) + execute_process( COMMAND ${NETCDF_PROGRAM} --cxx4libs OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_CXXLIBS ) + execute_process( COMMAND ${NETCDF_PROGRAM} --flibs OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_FLIBS ) + execute_process( COMMAND ${NETCDF_PROGRAM} --version OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_VERSION_RAW ) + execute_process( COMMAND ${NETCDF_PROGRAM} --has-nc4 OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_NC4_YES ) + execute_process( COMMAND ${NETCDF_PROGRAM} --has-pnetcdf OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_PNETCDF_YES ) + execute_process( COMMAND ${NETCDF_PROGRAM} --has-parallel OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_PARALLEL_YES ) + + + # Sanitize version + string( REPLACE " " ";" netCDF_VERSION_LIST ${netCDF_VERSION_RAW} ) + list( GET netCDF_VERSION_LIST -1 netCDF_VERSION ) + + # Convert to YES/NO - Note cannot be generator expression if you want to use it during configuration time + string( TOUPPER ${netCDF_NC4_YES} netCDF_NC4 ) + string( TOUPPER ${netCDF_PNETCDF_YES} netCDF_PNETCDF ) + string( TOUPPER ${netCDF_PARALLEL_YES} netCDF_PARALLEL ) + + set( netCDF_DEFINITIONS ) + + set( netCDF_LIBRARIES + $<$:${netCDF_CLIBS}> + $<$:${netCDF_CXXLIBS}> + $<$:${netCDF_FLIBS}> + ) + set( netCDF_INCLUDE_DIRS ${netCDF_INCLUDE_DIR} ) +endif() + +find_package( PkgConfig ) + +include(FindPackageHandleStandardArgs) + +# handle the QUIETLY and REQUIRED arguments and set netCDF_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args( netCDF DEFAULT_MSG + netCDF_INCLUDE_DIRS + netCDF_LIBRARY_DIR + netCDF_CLIBS + netCDF_CXXLIBS + netCDF_FLIBS + netCDF_VERSION + ) + +mark_as_advanced( netCDF_CLIBS netCDF_CXXLIBS netCDF_FLIBS netCDF_PREFIX netCDF_LIBRARY_DIR ) \ No newline at end of file diff --git a/cmake/template/WPSConfig.cmake.in b/cmake/template/WPSConfig.cmake.in new file mode 100644 index 000000000..7ca87890e --- /dev/null +++ b/cmake/template/WPSConfig.cmake.in @@ -0,0 +1,20 @@ +# WRF CMake Package + +@PACKAGE_INIT@ + +include( "${CMAKE_CURRENT_LIST_DIR}/@EXPORT_NAME@Targets.cmake" ) + +set( WRF_VERSION @PROJECT_VERSION@ ) + +# Options WPS was built with +set( WPS_WRF_DIR @WRF_DIR@ ) +set( WPS_USE_MPI @USE_MPI@ ) +set( WPS_USE_OPENMP @USE_OPENMP@ ) +set( WPS_BUILD_EXTERNALS @BUILD_EXTERNALS@ ) + + +find_package( ZLIB REQUIRED ) +find_package( PNG REQUIRED ) +find_package( Jasper REQUIRED ) + +check_required_components( "ungrib" ) \ No newline at end of file diff --git a/cmake/template/arch_config.cmake b/cmake/template/arch_config.cmake new file mode 100644 index 000000000..b31e022c8 --- /dev/null +++ b/cmake/template/arch_config.cmake @@ -0,0 +1,20 @@ +# https://cmake.org/cmake/help/latest/module/FindMPI.html#variables-for-locating-mpi +set( MPI_Fortran_COMPILER "{DM_FC}" ) +set( MPI_C_COMPILER "{DM_CC}" ) + +set( CMAKE_Fortran_COMPILER "{SFC}" ) +set( CMAKE_C_COMPILER "{SCC}" ) + +set( CMAKE_Fortran_FLAGS_INIT "{FFLAGS}" ) +set( CMAKE_C_FLAGS_INIT "{CFLAGS}" ) + +# set( CMAKE_Fortran_FLAGS_DEBUG_INIT "{{FCDEBUG}}" ) +# set( CMAKE_Fortran_FLAGS_RELEASE_INIT "{{FCOPTIM}}" ) + +# Project specifics now +set( WPS_MPI_Fortran_FLAGS "{DM_FC_FLAGS}" ) +set( WPS_MPI_C_FLAGS "{DM_CC_FLAGS}" ) +set( WPS_DEFINITIONS "{CPPFLAGS}" ) +# set( WPS_M4_FLAGS "{{M4_FLAGS}}" ) +# set( WPS_FCOPTIM "{{FCOPTIM}}" ) +# set( WPS_FCNOOPT "{{FCNOOPT}}" ) \ No newline at end of file diff --git a/cmake/wrf_get_version.cmake b/cmake/wrf_get_version.cmake new file mode 100644 index 000000000..668c9d694 --- /dev/null +++ b/cmake/wrf_get_version.cmake @@ -0,0 +1,11 @@ +# WRF Macro for getting version, this *should* be replaced with a better versioning scheme +macro( wrf_get_version WRF_VERSION_FILE ) + file( STRINGS ${WRF_VERSION_FILE} WRF_VERSION_FILE_OUTPUT ) + + list( POP_FRONT WRF_VERSION_FILE_OUTPUT FIRST_LINE ) + string( REPLACE " " ";" FIRST_LINE_LIST ${FIRST_LINE} ) + list( GET FIRST_LINE_LIST -1 WRF_VERSION ) + + set( PROJECT_VERSION ${WRF_VERSION} ) + message( STATUS "Setting project version to ${PROJECT_VERSION}" ) +endmacro() From e2e2bf98eec5ebc86ed3fb5d6c6dc75a89ecc539 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 28 Jun 2023 17:37:45 -0600 Subject: [PATCH 15/63] CMake build system, ready for MPAS usage --- CMakeLists.txt | 177 +++++++++++++++++++++++++++++++++++++++++++++++++ compile_new | 5 ++ configure_new | 15 +++++ 3 files changed, 197 insertions(+) create mode 100644 CMakeLists.txt create mode 100755 compile_new create mode 100755 configure_new diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..671aa7205 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,177 @@ +cmake_minimum_required( VERSION 3.20 ) +cmake_policy( SET CMP0118 NEW ) + +enable_language( C ) +enable_language( CXX ) +enable_language( Fortran ) + +project( WPS ) +set( EXPORT_NAME ${PROJECT_NAME} ) +set( INTERNAL_GRIB2_PATH ${CMAKE_INSTALL_PREFIX}/grib2 ) + +# if ( DEFINED CMAKE_TOOLCHAIN_FILE ) +# set( WPS_CONFIG ${CMAKE_TOOLCHAIN_FILE} ) +# message( STATUS "Loading configuration file... : ${WPS_CONFIG}" ) +# include( ${WPS_CONFIG} ) +# endif() + +# list( APPEND CMAKE_MODULE_PATH ) +list( APPEND CMAKE_MODULE_PATH + ${PROJECT_SOURCE_DIR}/cmake/ + ${PROJECT_SOURCE_DIR}/cmake/modules + ) + +# I'd love to be able to do something like this, but this would place a depedency +# on WRF which would be bad since who would expect the *WRF Preprocessing System* +# to have a strict dependency on WRF. Silly me +# if ( DEFINED WRF_DIR ) +# list( APPEND CMAKE_MODULE_PATH +# ${WRF_DIR}/share +# ) +# endif() + +# Use link paths as rpaths +set( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE ) +set( CMAKE_Fortran_PREPROCESS ON ) + +include( CMakePackageConfigHelpers ) +# include( confcheck ) +# include( gitinfo ) +include( wrf_get_version ) + +# Grab version info +wrf_get_version( ${PROJECT_SOURCE_DIR}/README ) + +################################################################################ +## +## MPI & OpenMP +## +################################################################################ +if ( ${USE_MPI} ) + # Through ***MUCH*** debugging, if utilizing MPI__COMPILER + # https://cmake.org/cmake/help/latest/module/FindMPI.html#variables-for-locating-mpi + # the find logic makes a mess of things by utilizing -show[me] + # Which may or may not get polluted by the environment + # It still technically finds MPI but the output is nonintuitive + # saying things like hdf5 or pthread + find_package( MPI REQUIRED COMPONENTS Fortran C ) + add_compile_definitions( + USE_MPI=1 + DM_PARALLEL + ) + + if ( DEFINED WRF_MPI_Fortran_FLAGS AND NOT "${WRF_MPI_Fortran_FLAGS}" STREQUAL "" ) + add_compile_options( + $<$,${WRF_MPI_Fortran_FLAGS}> + ) + endif() + + if ( DEFINED WRF_MPI_C_FLAGS AND NOT "${WRF_MPI_C_FLAGS}" STREQUAL "" ) + add_compile_options( + $<$,${WRF_MPI_C_FLAGS}> + ) + endif() +endif() + +if ( ${USE_OPENMP} ) + find_package( OpenMP REQUIRED COMPONENTS Fortran C ) + add_compile_definitions( USE_OPENMP=1 SM_PARALLEL ) +endif() + + +# First do externals +if ( BUILD_EXTERNALS ) + add_subdirectory( external ) + # If we got here everything built, we are safe to add find paths for libs + set( ZLIB_ROOT ${INTERNAL_GRIB2_PATH} ) # This may get overridden by HDF5 if zlib is packaged with that + set( PNG_ROOT ${INTERNAL_GRIB2_PATH} ) + set( Jasper_ROOT ${INTERNAL_GRIB2_PATH} ) +endif() + + +# Now find required libraries, which may have been affected by externals +if ( DEFINED WRF_DIR ) + find_package( WRF COMPONENTS WRF_Core io_netcdf io_grib1 io_int HINTS ${WRF_DIR}/lib ) +endif() + +# Find externals now -- this is a little different than normal since we want WRF to +# take precedence if it is present on which libraries to use to avoid library splicing +# rather than finding our external thirdparty libraries first +find_package( ZLIB REQUIRED ) +find_package( PNG REQUIRED ) +find_package( Jasper REQUIRED ) + +# Add config definitions +message( STATUS "Adding configuration specific definitions : ${WPS_DEFINITIONS}" ) +# In CMake 2.26 this will not be necessary +string( REPLACE " " ";" WPS_DEFINITIONS_LIST ${WPS_DEFINITIONS} ) +list( TRANSFORM WPS_DEFINITIONS_LIST REPLACE "^-D(.*)" "\\1" ) +add_compile_definitions( + ${WPS_DEFINITIONS_LIST} + $<$:USE_JPEG2000> + $<$:USE_PNG> + ) + +# Always build whatever we can +add_subdirectory( ungrib ) + +if ( DEFINED WRF_DIR ) + # WRF Specific things + add_subdirectory( metgrid ) + add_subdirectory( geogrid ) +endif() + + +################################################################################ +## +## Install and export +## +################################################################################ + +# Install to namespace +install( + EXPORT ${EXPORT_NAME}Targets + DESTINATION lib/cmake/ + FILE ${EXPORT_NAME}Targets.cmake + NAMESPACE ${EXPORT_NAME}:: + ) + +configure_package_config_file( + ${PROJECT_SOURCE_DIR}/cmake/template/${EXPORT_NAME}Config.cmake.in + ${CMAKE_BINARY_DIR}/${EXPORT_NAME}Config.cmake + INSTALL_DESTINATION lib/cmake + ) + +write_basic_package_version_file( + ${CMAKE_BINARY_DIR}/${EXPORT_NAME}ConfigVersion.cmake + VERSION ${PROJECT_VERSION} + #!TODO Check if this is the type of versioning support we want to use + COMPATIBILITY SameMinorVersion + ) + +install( + FILES + ${CMAKE_BINARY_DIR}/${EXPORT_NAME}Config.cmake + ${CMAKE_BINARY_DIR}/${EXPORT_NAME}ConfigVersion.cmake + DESTINATION lib/cmake + ) + +# Install some helper files for anyone using this build as part of their code +install( + DIRECTORY + # Trailing / is important + ${PROJECT_SOURCE_DIR}/cmake/modules/ + COMPONENT helpers + DESTINATION share + FILES_MATCHING + PATTERN "*.cmake" + ) +# install( +# FILES +# ${PROJECT_SOURCE_DIR}/cmake/confcheck.cmake +# ${PROJECT_SOURCE_DIR}/cmake/gitinfo.cmake +# ${PROJECT_SOURCE_DIR}/cmake/printOption.cmake +# ${PROJECT_SOURCE_DIR}/cmake/wrf_get_version.cmake +# COMPONENT helpers +# DESTINATION share +# ) diff --git a/compile_new b/compile_new new file mode 100755 index 000000000..758e4a808 --- /dev/null +++ b/compile_new @@ -0,0 +1,5 @@ +#!/bin/bash +# Meant to be run at the top level + +# Now run cmake +cmake --build _build --target install $* \ No newline at end of file diff --git a/configure_new b/configure_new new file mode 100755 index 000000000..f323e5ea5 --- /dev/null +++ b/configure_new @@ -0,0 +1,15 @@ +#!/bin/sh +# Meant to be run at the top level +./arch/configure_reader.py \ + arch/configure.defaults \ + cmake/template/arch_config.cmake \ + wps_config.cmake \ + CMakeLists.txt + +WRF_DIR= +if [ ! -z $1 ]; then + WRF_DIR=-DWRF_DIR="$1" +fi + +# Now run cmake +cmake -S . -B _build -DCMAKE_INSTALL_PREFIX=$PWD/run -DCMAKE_TOOLCHAIN_FILE=$PWD/wps_config.cmake ${WRF_DIR} \ No newline at end of file From 0af8e9b36a4ade55bd0c4af4f335a208d19a4e70 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 29 Jun 2023 17:19:46 -0600 Subject: [PATCH 16/63] geogrid build --- geogrid/CMakeLists.txt | 47 ++++++++++++++++++++++++++++++++++++++ geogrid/src/CMakeLists.txt | 27 ++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 geogrid/CMakeLists.txt create mode 100644 geogrid/src/CMakeLists.txt diff --git a/geogrid/CMakeLists.txt b/geogrid/CMakeLists.txt new file mode 100644 index 000000000..d243adc81 --- /dev/null +++ b/geogrid/CMakeLists.txt @@ -0,0 +1,47 @@ +add_executable( geogrid ) + +add_subdirectory( src ) + +set_target_properties( + geogrid + PROPERTIES + # Just dump everything in here + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/geogrid/ + Fortran_FORMAT FREE + ) + + +# Control dependencies and linking +target_link_libraries( + geogrid + PRIVATE + $<$:$> + $<$:$> + $<$:$> + ${netCDF_LIBRARIES} + WRF::WRF_Core + WRF::io_netcdf + WRF::io_grib1 + WRF::io_grib_share + ) + +target_compile_definitions( + geogrid + PRIVATE + _GEOGRID + ) + +target_include_directories( + geogrid + PRIVATE + ${netCDF_INCLUDE_DIRS} + ) + +# Add these to the export targets +install( + TARGETS geogrid + EXPORT ${EXPORT_NAME}Targets + RUNTIME DESTINATION bin/ + ARCHIVE DESTINATION lib/ + LIBRARY DESTINATION lib/ + ) diff --git a/geogrid/src/CMakeLists.txt b/geogrid/src/CMakeLists.txt new file mode 100644 index 000000000..77628f81f --- /dev/null +++ b/geogrid/src/CMakeLists.txt @@ -0,0 +1,27 @@ + +target_sources( + geogrid + PRIVATE + cio.c + wrf_debug.F + bitarray_module.F + constants_module.F + module_stringutil.F + geogrid.F + gridinfo_module.F + hash_module.F + interp_module.F + list_module.F + llxy_module.F + misc_definitions_module.F + module_debug.F + module_map_utils.F + output_module.F + parallel_module.F + process_tile_module.F + proc_point_module.F + queue_module.F + read_geogrid.c + smooth_module.F + source_data_module.F + ) \ No newline at end of file From 23daf8dc2e9e57743fe6a6798e66f0be99282c64 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 29 Jun 2023 17:20:02 -0600 Subject: [PATCH 17/63] metgrid build --- metgrid/CMakeLists.txt | 47 ++++++++++++++++++++++++++++++++++++++ metgrid/src/CMakeLists.txt | 36 +++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 metgrid/CMakeLists.txt create mode 100644 metgrid/src/CMakeLists.txt diff --git a/metgrid/CMakeLists.txt b/metgrid/CMakeLists.txt new file mode 100644 index 000000000..d90980ea7 --- /dev/null +++ b/metgrid/CMakeLists.txt @@ -0,0 +1,47 @@ +add_executable( metgrid ) + +add_subdirectory( src ) + +set_target_properties( + metgrid + PROPERTIES + # Just dump everything in here + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/metgrid/ + Fortran_FORMAT FREE + ) + + +# Control dependencies and linking +target_link_libraries( + metgrid + PRIVATE + $<$:$> + $<$:$> + $<$:$> + ${netCDF_LIBRARIES} + WRF::WRF_Core + WRF::io_netcdf + WRF::io_grib1 + WRF::io_grib_share + ) + +target_compile_definitions( + metgrid + PRIVATE + _METGRID + ) + +target_include_directories( + metgrid + PRIVATE + ${netCDF_INCLUDE_DIRS} + ) + +# Add these to the export targets +install( + TARGETS metgrid + EXPORT ${EXPORT_NAME}Targets + RUNTIME DESTINATION bin/ + ARCHIVE DESTINATION lib/ + LIBRARY DESTINATION lib/ + ) diff --git a/metgrid/src/CMakeLists.txt b/metgrid/src/CMakeLists.txt new file mode 100644 index 000000000..8720ebab7 --- /dev/null +++ b/metgrid/src/CMakeLists.txt @@ -0,0 +1,36 @@ +target_sources( + metgrid + PRIVATE + cio.c + wrf_debug.F + bitarray_module.F + constants_module.F + datatype_module.F + module_stringutil.F + gridinfo_module.F + metgrid.F + input_module.F + interp_module.F + interp_option_module.F + list_module.F + llxy_module.F + met_data_module.F + minheap_module.F + misc_definitions_module.F + module_date_pack.F + module_debug.F + module_map_utils.F + module_mergesort.F + output_module.F + parallel_module.F + process_domain_module.F + queue_module.F + read_met_module.F + rotate_winds_module.F + storage_module.F + write_met_module.F + scan_input.F + mpas_mesh.F + target_mesh.F + remapper.F + ) \ No newline at end of file From 6e9039abac55940493e62481aaf6a4186d2f272b Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 29 Jun 2023 17:20:59 -0600 Subject: [PATCH 18/63] Of course I have to add custom 'compat' flags for GNU that aren't in default flags for compiler specific flags already --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 671aa7205..b8b04ff2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,10 @@ project( WPS ) set( EXPORT_NAME ${PROJECT_NAME} ) set( INTERNAL_GRIB2_PATH ${CMAKE_INSTALL_PREFIX}/grib2 ) +if ( NOT DEFINED WRF_DIR ) + message( STATUS "No WRF_DIR provided, skipping targets that rely on WRF" ) +endif() + # if ( DEFINED CMAKE_TOOLCHAIN_FILE ) # set( WPS_CONFIG ${CMAKE_TOOLCHAIN_FILE} ) # message( STATUS "Loading configuration file... : ${WPS_CONFIG}" ) @@ -111,6 +115,11 @@ add_compile_definitions( $<$:USE_JPEG2000> $<$:USE_PNG> ) +# Whole project flags +add_compile_options( + $<$:-fallow-argument-mismatch> + ) + # Always build whatever we can add_subdirectory( ungrib ) From 9cf970687da0969342371aa8dd7afedff147b226 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 6 Jul 2023 15:15:12 -0600 Subject: [PATCH 19/63] Bringing in changes from respective wrf module --- cmake/modules/FindnetCDF.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmake/modules/FindnetCDF.cmake b/cmake/modules/FindnetCDF.cmake index f9051f079..dbc3f9274 100644 --- a/cmake/modules/FindnetCDF.cmake +++ b/cmake/modules/FindnetCDF.cmake @@ -33,6 +33,15 @@ else() execute_process( COMMAND ${NETCDF_PROGRAM} --has-pnetcdf OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_PNETCDF_YES ) execute_process( COMMAND ${NETCDF_PROGRAM} --has-parallel OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_PARALLEL_YES ) + # check for large file support + find_file( netCDF_INCLUDE_FILE netcdf.inc ${netCDF_INCLUDE_DIR} ) + file( READ ${netCDF_INCLUDE_FILE} netCDF_INCLUDE_FILE_STR ) + string( FIND "${netCDF_INCLUDE_FILE_STR}" "nf_format_64bit" netCDF_LARGE_FILE_SUPPORT_FOUND ) + if ( ${netCDF_SUPPORT_LARGE_FILE_FOUND} EQUAL -1 ) + set( netCDF_LARGE_FILE_SUPPORT "NO" ) + else() + set( netCDF_LARGE_FILE_SUPPORT "YES" ) + endif() # Sanitize version string( REPLACE " " ";" netCDF_VERSION_LIST ${netCDF_VERSION_RAW} ) From 489f711543e91fcc2b47db331c80035aba44f119 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 6 Jul 2023 15:33:36 -0600 Subject: [PATCH 20/63] Fixing variable typo --- cmake/modules/FindnetCDF.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindnetCDF.cmake b/cmake/modules/FindnetCDF.cmake index dbc3f9274..da0faec44 100644 --- a/cmake/modules/FindnetCDF.cmake +++ b/cmake/modules/FindnetCDF.cmake @@ -37,7 +37,7 @@ else() find_file( netCDF_INCLUDE_FILE netcdf.inc ${netCDF_INCLUDE_DIR} ) file( READ ${netCDF_INCLUDE_FILE} netCDF_INCLUDE_FILE_STR ) string( FIND "${netCDF_INCLUDE_FILE_STR}" "nf_format_64bit" netCDF_LARGE_FILE_SUPPORT_FOUND ) - if ( ${netCDF_SUPPORT_LARGE_FILE_FOUND} EQUAL -1 ) + if ( ${netCDF_LARGE_FILE_SUPPORT_FOUND} EQUAL -1 ) set( netCDF_LARGE_FILE_SUPPORT "NO" ) else() set( netCDF_LARGE_FILE_SUPPORT "YES" ) From 2eb6d602acdc1f0e26ceef122e8461ea3176a913 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Fri, 7 Jul 2023 17:13:46 -0600 Subject: [PATCH 21/63] Adding util/ build targets --- CMakeLists.txt | 9 +--- util/CMakeLists.txt | 92 +++++++++++++++++++++++++++++++++++++++++ util/src/CMakeLists.txt | 72 ++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+), 7 deletions(-) create mode 100644 util/CMakeLists.txt create mode 100644 util/src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index b8b04ff2a..fd5f5e252 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,13 +13,6 @@ if ( NOT DEFINED WRF_DIR ) message( STATUS "No WRF_DIR provided, skipping targets that rely on WRF" ) endif() -# if ( DEFINED CMAKE_TOOLCHAIN_FILE ) -# set( WPS_CONFIG ${CMAKE_TOOLCHAIN_FILE} ) -# message( STATUS "Loading configuration file... : ${WPS_CONFIG}" ) -# include( ${WPS_CONFIG} ) -# endif() - -# list( APPEND CMAKE_MODULE_PATH ) list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/ ${PROJECT_SOURCE_DIR}/cmake/modules @@ -130,6 +123,8 @@ if ( DEFINED WRF_DIR ) add_subdirectory( geogrid ) endif() +add_subdirectory( util ) + ################################################################################ ## diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt new file mode 100644 index 000000000..54b67ef8e --- /dev/null +++ b/util/CMakeLists.txt @@ -0,0 +1,92 @@ +add_library( util_common STATIC ) +# todo - Find how to compile this with NCAR Graphics, will need to write a find_package() module +# add_executable( plotgrids ) +add_executable( rd_intermediate ) +add_executable( avg_tsfc ) +# Find out if this needs compiling, ./compile suggests no +# add_executable( elev_angle ) +add_executable( calc_ecmwf_p ) +# Same thing as plotgrids +# add_executable( plotfmt ) +add_executable( mod_levs ) +if ( DEFINED WRF_DIR ) + add_executable( int2nc ) +endif() +add_executable( height_ukmo ) + +set( + ALL_UTIL_TARGETS + # plotgrids + rd_intermediate + avg_tsfc + # elev_angle + calc_ecmwf_p + # plotfmt + mod_levs + height_ukmo + ) + +if ( DEFINED WRF_DIR ) + list( APPEND ALL_UTIL_TARGETS int2nc ) +endif() + +add_subdirectory( src ) + +# Specific linking +# target_link_libraries( +# elev_angle +# PRIVATE +# ${netCDF_LIBRARIES} +# ) +# target_include_directories( +# elev_angle +# PRIVATE +# ${netCDF_INCLUDE_DIRS} +# ) + +if ( DEFINED WRF_DIR ) + target_link_libraries( + int2nc + PRIVATE + WRF::WRF_Core + ${netCDF_LIBRARIES} + ) + target_include_directories( + int2nc + PRIVATE + ${netCDF_INCLUDE_DIRS} + ) +endif() + +# Every single target +foreach( TARGET ${ALL_UTIL_TARGETS} util_common ) + + # Set the mod dir + set_target_properties( + ${TARGET} + PROPERTIES + # Just dump everything in here + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/util/ + Fortran_FORMAT FREE + ) + + # Everything except util_common + if ( NOT "${TARGET}" STREQUAL util_common ) + target_link_libraries( + ${TARGET} + PRIVATE + util_common + ) + endif() + + # Add these to the export targets + install( + TARGETS ${TARGET} + EXPORT ${EXPORT_NAME}Targets + RUNTIME DESTINATION bin/ + ARCHIVE DESTINATION lib/ + LIBRARY DESTINATION lib/ + ) + +endforeach() + diff --git a/util/src/CMakeLists.txt b/util/src/CMakeLists.txt new file mode 100644 index 000000000..d357c8d99 --- /dev/null +++ b/util/src/CMakeLists.txt @@ -0,0 +1,72 @@ +# Common +target_sources( + util_common + PRIVATE + read_met_module.F + write_met_module.F + module_debug.F + constants_module.F + met_data_module.F + cio.c + misc_definitions_module.F + gridinfo_module.F + module_date_pack.F + ) + +target_sources( + rd_intermediate + PRIVATE + rd_intermediate.F + ) + +# target_sources( +# plotgrids +# PRIVATE +# plotgrids.F +# module_map_utils.F +# ) + +target_sources( + avg_tsfc + PRIVATE + avg_tsfc.F + ) + +# target_sources( +# elev_angle +# PRIVATE +# elev_angle.F +# ) + +target_sources( + calc_ecmwf_p + PRIVATE + calc_ecmwf_p.F + module_stringutil.F + ) + + +# target_sources( +# plotfmt +# PRIVATE +# plotfmt.F +# ) + +target_sources( + mod_levs + PRIVATE + mod_levs.F + ) +if ( DEFINED WRF_DIR ) + target_sources( + int2nc + PRIVATE + int2nc.F + ) +endif() + +target_sources( + height_ukmo + PRIVATE + height_ukmo.F + ) \ No newline at end of file From 88c308d259a1f222e5095e2ff84f37f70624d20f Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Fri, 7 Jul 2023 17:48:31 -0600 Subject: [PATCH 22/63] Keeping up-to-date with WRF module --- cmake/modules/FindnetCDF.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindnetCDF.cmake b/cmake/modules/FindnetCDF.cmake index da0faec44..6768e2aae 100644 --- a/cmake/modules/FindnetCDF.cmake +++ b/cmake/modules/FindnetCDF.cmake @@ -72,7 +72,7 @@ find_package_handle_standard_args( netCDF DEFAULT_MSG netCDF_INCLUDE_DIRS netCDF_LIBRARY_DIR netCDF_CLIBS - netCDF_CXXLIBS + # netCDF_CXXLIBS netCDF_FLIBS netCDF_VERSION ) From d902b98f52cc5c7cdfcf58a07c637a61bd1eb00b Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Fri, 14 Jul 2023 16:42:41 -0600 Subject: [PATCH 23/63] Rolling back to older cmake process to allow version checking to work --- cleanCMake.sh | 5 +++-- compile_new | 3 ++- configure_new | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cleanCMake.sh b/cleanCMake.sh index d6ab05299..51b140509 100755 --- a/cleanCMake.sh +++ b/cleanCMake.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh BUILD_DIR=_build INSTALL_DIR=run TEST_DIR=test/ @@ -50,7 +50,8 @@ fi if [[ "${CLEAN_BASIC_BUILD}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then echo "Doing cmake make clean" - cmake --build ${BUILD_DIR} -j 1 --target clean + OLD_DIR=$PWD + cd ${BUILD_DIR} && make -j 1 clean && cd $OLD_DIR fi if [[ "${CLEAN_BASIC_INSTALL}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then diff --git a/compile_new b/compile_new index 758e4a808..2f21eb0c5 100755 --- a/compile_new +++ b/compile_new @@ -2,4 +2,5 @@ # Meant to be run at the top level # Now run cmake -cmake --build _build --target install $* \ No newline at end of file +cd _build && make install $* +# cmake --build _build --target install $* \ No newline at end of file diff --git a/configure_new b/configure_new index f323e5ea5..96368fdc9 100755 --- a/configure_new +++ b/configure_new @@ -12,4 +12,7 @@ if [ ! -z $1 ]; then fi # Now run cmake -cmake -S . -B _build -DCMAKE_INSTALL_PREFIX=$PWD/run -DCMAKE_TOOLCHAIN_FILE=$PWD/wps_config.cmake ${WRF_DIR} \ No newline at end of file +mkdir -p _build/ +cd _build +cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../run -DCMAKE_TOOLCHAIN_FILE=$PWD/..//wps_config.cmake ${WRF_DIR} +# cmake -S . -B _build \ No newline at end of file From 361ee578076ce20c563ebc41cc8687b3ace16543 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Fri, 14 Jul 2023 16:43:59 -0600 Subject: [PATCH 24/63] Setting to standard shell --- compile_new | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile_new b/compile_new index 2f21eb0c5..121f83537 100755 --- a/compile_new +++ b/compile_new @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Meant to be run at the top level # Now run cmake From 4aa80f8ce6bf14b2c133ef325fd5d4a0f64457c7 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Mon, 31 Jul 2023 14:32:54 -0600 Subject: [PATCH 25/63] Updating to better configuration selection --- arch/configure_reader.py | 303 +++++++++++++++++++++++-------- cmake/template/arch_config.cmake | 4 +- 2 files changed, 233 insertions(+), 74 deletions(-) diff --git a/arch/configure_reader.py b/arch/configure_reader.py index 45f3ae70e..18cc532a9 100755 --- a/arch/configure_reader.py +++ b/arch/configure_reader.py @@ -4,6 +4,7 @@ import re import inspect import platform +from shutil import which archBlock = re.compile( r"(?:#[ ]*)(ARCH(?:.*\n)*?)(?:#{5,})", re.I ) kvPair = re.compile( r"^(\w+)(?:[ \t]*=[ \t]*)(.*?)$", re.I | re.M ) @@ -13,46 +14,78 @@ # Just grab the first two words, thats what you get osAndArchAlt = re.compile( r"^ARCH[ ]+(\w+)[ ]+(\w+)", re.I ) -referenceVar = re.compile( r"[$][(](\w+)[)]", re.I ) +referenceVar = re.compile( r"[$]([(])?(\w+)(?(1)[)])", re.I ) +compileObject = re.compile( r"(\W)-c(\W)" ) class Stanza(): def __init__( self, lines ) : self.lines_ = lines self.os_ = None + self.arch_ = None + self.osArchLine_ = None self.archs_ = [] self.kvPairs_ = {} + self.crossPlatform_ = False + self.skipCrossPlatform_ = True + self.serialOpt_ = False + self.smparOpt_ = False + self.dmparOpt_ = False + self.dmsmOpt_ = False def parse( self ) : + self.osArchLine_ = self.lines_.partition("\n")[0] # First get os & archs - osarchMatch = osAndArch.match( self.lines_ ) + osarchMatch = osAndArch.match( self.osArchLine_ ) if osarchMatch is None : - osarchMatch = osAndArchAlt.match( self.lines_ ) + osarchMatch = osAndArchAlt.match( self.osArchLine_ ) if osarchMatch is None : - print( "Could not find OS and architecture info in " + self.lines_.partition("\n")[0] ) + print( "Could not find OS and architecture info in " + self.osArchLine_ ) self.os_ = osarchMatch.group(1) self.archs_ = osarchMatch.group(2).strip(",").split( " " ) - - for kvPairMatch in kvPair.finditer( self.lines_ ) : - self.kvPairs_[ kvPairMatch.group(1) ] = kvPairMatch.group(2) - self.removeComments( kvPairMatch.group(1) ) - - # Now sanitize - self.sanitize() + + if ( self.os_.lower() != platform.system().lower() or + platform.machine() not in self.archs_ ) : + self.crossPlatform_ = True + + # Allow cross platform or must not be cross platform + if not self.skipCrossPlatform_ or ( self.skipCrossPlatform_ and not self.crossPlatform_ ) : + + # Find OpenMP/MPI compilation options + memOpts = self.osArchLine_.partition( "#" )[-1].split( " " ) + # print( memOpts ) + self.serialOpt_ = "serial" in memOpts + self.smparOpt_ = "smpar" in memOpts + self.dmparOpt_ = "dmpar" in memOpts + self.dmsmOpt_ = "dm+sm" in memOpts + + for kvPairMatch in kvPair.finditer( self.lines_ ) : + self.kvPairs_[ kvPairMatch.group(1) ] = kvPairMatch.group(2) + self.removeComments( kvPairMatch.group(1) ) + + # Now sanitize + self.sanitize() + ###################################################################################################################### + ## + ## search and replace $() and $ instances + ## + ###################################################################################################################### def dereference( self, field, fatal=False ) : + # print( "Dereferencing " + field ) if field in self.kvPairs_ : prevField = self.kvPairs_[field] for refVarIter in referenceVar.finditer( prevField ) : if refVarIter is not None : # Grab group 1 and check that it is in our kv pairs - refVar = refVarIter.group(1) + refVar = refVarIter.group(2) + # print( "Found variable {0} in field {1}".format( refVar, field ) ) if refVar not in self.kvPairs_ : if fatal : - print( "Could not rereference : " + refVar ) + # print( "Could not rereference : " + refVar ) exit(1) else: continue @@ -62,7 +95,7 @@ def dereference( self, field, fatal=False ) : # Replace in original self.kvPairs_[field] = self.kvPairs_[field].replace( - "$({var})".format( var=refVar ), + "{var}".format( var=refVarIter.group(0) ), self.kvPairs_[refVar] ) @@ -90,46 +123,63 @@ def splitIntoFieldAndFlags( self, field ) : self.kvPairs_[field] = fieldValue.partition(" ")[0] self.kvPairs_[field + "_FLAGS"] = fieldValue.partition(" ")[1] + ###################################################################################################################### + ## + ## Clean up the stanza so kv pairs can be used as-is + ## + ###################################################################################################################### def sanitize( self ) : # Fix problematic variables self.dereference( "DM_FC" ) self.dereference( "DM_CC" ) - # self.removeReferences( "FCBASEOPTS_NO_G" ) + self.removeReferences( "FCBASEOPTS_NO_G" ) # Get rid of all these mixed up flags, these are handled by cmake natively or # just in the wrong place + self.removeReferences( "FCBASEOPTS", [ "FCDEBUG", "FORMAT_FREE", "BYTESWAPIO", ] ) self.removeReferences( "FFLAGS", [ "FORMAT_FREE", "FORMAT_FIXED" ] ) self.removeReferences( "F77FLAGS", [ "FORMAT_FREE", "FORMAT_FIXED" ] ) # # Now deref - # self.dereference( "FCBASEOPTS" ) + self.dereference( "FCBASEOPTS" ) # Now fix certain ones that are mixing programs with flags all mashed into one option + self.splitIntoFieldAndFlags( "SFC" ) + self.splitIntoFieldAndFlags( "SCC" ) self.splitIntoFieldAndFlags( "DM_FC" ) self.splitIntoFieldAndFlags( "DM_CC" ) self.splitIntoFieldAndFlags( "M4" ) # Remove rogue compile commands that should *NOT* even be here keysToSanitize = [ - "COMPRESSION_LIBS", + "ARFLAGS","ARFLAGS", + "CC", + "CFLAGS_LOCAL", + "CFLAGS", "COMPRESSION_INC", - "FDEFS", - "SFC", - "SCC", - "DM_FC", + "COMPRESSION_LIBS", + "CPP", + "CPPFLAGS", "DM_CC", - "FC", - "CC", - "LD", - "FFLAGS", + "DM_FC", + "ESMF_LDFLAG", "F77FLAGS", - "FORMAT_FREE", - "FORMAT_FIXED", + "FC", + "FCBASEOPTS_NO_G", + "FCBASEOPTS", + "FCOPTIM", "FCSUFFIX", + "FDEFS", + "FFLAGS", "FNGFLAGS", + "FORMAT_FIXED", + "FORMAT_FREE", + "LD", + "LDFLAGS_LOCAL", "LDFLAGS", - "CFLAGS", - "CPP", - "CPPFLAGS", - "ARFLAGS" + "MODULE_SRCH_FLAG", + "RLFLAGS", + "SCC", + "SFC", + "TRADFLAG", ] for keyToSan in keysToSanitize : @@ -141,6 +191,9 @@ def sanitize( self ) : self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_FDEFS", "" ) self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_MPI", "" ) self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMPAT_FLAGS", "" ) + + compileObject.sub( "\1\2", self.kvPairs_[ keyToSan ] ) + # self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "-c", "" ) # Now deref all the rest for key in self.kvPairs_ : @@ -148,6 +201,17 @@ def sanitize( self ) : # And for final measure strip self.kvPairs_[ key ] = self.kvPairs_[ key ].strip() + def serialCompilersAvailable( self ) : + return which( self.kvPairs_["SFC"] ) is not None and which( self.kvPairs_["SCC"] ) is not None + + def dmCompilersAvailable( self ) : + return which( self.kvPairs_["DM_FC"] ) is not None and which( self.kvPairs_["DM_CC"] ) is not None + + ###################################################################################################################### + ## + ## string representation to view as option + ## + ###################################################################################################################### def __str__( self ): # base = """OS {os:<8} ARCHITECTURES {archs:<20} # >> SFC = {SFC:<12} @@ -156,21 +220,27 @@ def __str__( self ): # >> DM_FC = {DM_FC:<12} # >> DM_CC = {DM_CC:<12} # """ - # print( self.kvPairs_ ) - base = """{rec} {os:<10} {SFC:<11} / {SCC:<11} / {DM_FC:<11} / {DM_CC:<11}""" + base = """ {os:<10} {recSFC} {SFC:<11} / {recSCC} {SCC:<11} / {recDM_FC} {DM_FC:<11} / {recDM_CC} {DM_CC:<11}""" text = inspect.cleandoc( base ).format( os=str(self.os_), - rec=( "!!" if platform.system().lower() != self.os_.lower() else "Ok" ), + recSFC =( "!!" if which( self.kvPairs_["SFC"] ) is None else (" " * 2 ) ), + recSCC =( "!!" if which( self.kvPairs_["SCC"] ) is None else (" " * 2 ) ), + recDM_FC=( "!!" if which( self.kvPairs_["DM_FC"] ) is None else (" " * 2 ) ), + recDM_CC=( "!!" if which( self.kvPairs_["DM_CC"] ) is None else (" " * 2 ) ), # archs=str(self.archs_), - SFC=str( self.kvPairs_["SFC"].partition(" ")[0] ), - SCC=str( self.kvPairs_["SCC"].partition(" ")[0] ), - # CCOMP=str( self.kvPairs_["CCOMP"].partition(" ")[0] ), - DM_FC=str( self.kvPairs_["DM_FC"].partition(" ")[0] ), - DM_CC=str( self.kvPairs_["DM_CC"].partition(" ")[0] ) + SFC=str( self.kvPairs_["SFC"] ), + SCC=str( self.kvPairs_["SCC"] ), + DM_FC=str( self.kvPairs_["DM_FC"] ), + DM_CC=str( self.kvPairs_["DM_CC"] ) ) # text += "\n" + "\n".join( [ "{key:<18} = {value}".format( key=key, value=value) for key, value in self.kvPairs_.items() ] ) return text + ###################################################################################################################### + ## + ## Find first apparent difference between two stanzas + ## + ###################################################################################################################### @staticmethod def findFirstDifference( rhStanza, lhStanza, maxLength=32 ) : diff = False @@ -180,15 +250,15 @@ def findFirstDifference( rhStanza, lhStanza, maxLength=32 ) : "BYTESWAPIO", "CFLAGS_LOCAL", "CFLAGS", - "FFLAGS", + "DM_CC_FLAGS", "DM_CC", - "DM_FC", "DM_FC_FLAGS", - "DM_CC_FLAGS", + "DM_FC", "FCBASEOPTS", "FCDEBUG", "FCNOOPT", "FCOPTIM", + "FFLAGS", "M4_FLAGS", "SCC", "SFC" @@ -205,7 +275,11 @@ def findFirstDifference( rhStanza, lhStanza, maxLength=32 ) : return diff, value - +######################################################################################################################## +## +## Select enum-like string for string-based cmake options +## +######################################################################################################################## def getStringOptionSelection( topLevelCmake, searchString ) : topLevelCmakeFP = open( topLevelCmake, "r" ) topLevelCmakeLines = topLevelCmakeFP.read() @@ -225,7 +299,7 @@ def getStringOptionSelection( topLevelCmake, searchString ) : options = [ option for option in options if option ] optionsFmt = ", ".join( [ "{idx} : {opt}".format( idx=options.index( opt ), opt=opt ) for opt in options ] ) - selection = int( input( "Select string options [0-{max}] ({opts}) : ".format( max=len(options)-1, opts=optionsFmt ) ) ) + selection = int( input( "Select option from {optionsStr} [0-{max}] ({opts}) : ".format( optionsStr=searchString, max=len(options)-1, opts=optionsFmt ) ) ) if selection < 0 or selection > len(options) : print( "Invalid option selection for " + searchString + "!" ) @@ -233,6 +307,63 @@ def getStringOptionSelection( topLevelCmake, searchString ) : return options[selection] +######################################################################################################################## +## +## Aggregate and allow toggle of various suboptions in alternate menu +## +######################################################################################################################## +def getSubOptions( topLevelCmake, ignoreOptions ) : + topLevelCmakeFP = open( topLevelCmake, "r" ) + topLevelCmakeLines = topLevelCmakeFP.read() + topLevelCmakeFP.close() + + stringOptionsMatch = re.finditer( + r"set\s*[(]\s*(\w+)\s*(ON|OFF)\s*CACHE\s*BOOL\s*\"(.*?)\"\s*[)]", + topLevelCmakeLines, + re.I | re.M + ) + # Remove commented ones and ones that don't follow pattern set( ON|OFF CACHE BOOL "" ) + options = [ [ option.group( 1 ), option.group( 2 ) ] for option in stringOptionsMatch if option.group( 1 ) == option.group( 3 ) and option.group(0).split( "#", 1 )[0].strip() ] + + # Remove ignore options + options = [ option for option in options if option[0] not in ignoreOptions ] + subOptions = {} + + if options : + subOptionQuit = False + optionToggleIdx = -1 + + # Print menu + optionStr = "{idx:<3} {option:<24} : {value:<5}" + print( optionStr.format( idx="ID", option="Option", value="Default" ) ) + for opt in options : + print( optionStr.format( idx=options.index(opt), option=opt[0], value=opt[1] ) ) + + print( "Enter ID to toggle option on or off, q to quit : " ) + # Loop until q, toggle from default not current value + while not subOptionQuit : + optionToggleIdx = input() + try: + optionToggleIdx = int( optionToggleIdx ) + if optionToggleIdx < 0 or optionToggleIdx >= len( options ) : + print( "Not a valid index" ) + else: + subOptions[ options[optionToggleIdx][0] ] = "ON" if not ( options[optionToggleIdx][1] == "ON" ) else "OFF" + print( "Set {option} to {value}".format( option=options[optionToggleIdx][0], value=subOptions[ options[optionToggleIdx][0] ] ) ) + except ValueError as err : + subOptionQuit = optionToggleIdx.lower() == "q" + + return subOptions + +######################################################################################################################## +######################################################################################################################## +## +## ABOVE THIS BREAK THINGS ARE EXACTLY THE SAME AS WRF/WPS +## BELOW THIS BREAK THINGS DIFFER +## +######################################################################################################################## +######################################################################################################################## + def generateCMakeToolChainFile( cmakeToolChainTemplate, output, stanza, optionsDict={} ) : cmakeToolChainTemplateFP = open( cmakeToolChainTemplate, "r" ) cmakeToolChainTemplateLines = cmakeToolChainTemplateFP.read() @@ -253,7 +384,9 @@ def generateCMakeToolChainFile( cmakeToolChainTemplate, output, stanza, optionsD # FCOPTIM=stanza.kvPairs_["FCOPTIM"], # M4_FLAGS=stanza.kvPairs_["M4_FLAGS"], SCC=stanza.kvPairs_["SCC"], - SFC=stanza.kvPairs_["SFC"] + SFC=stanza.kvPairs_["SFC"], + SCC_FLAGS=stanza.kvPairs_["SCC_FLAGS"], + SFC_FLAGS=stanza.kvPairs_["SFC_FLAGS"] ) # Extra stufff not from stanza but options @@ -270,19 +403,6 @@ def main() : cmakeConfigFile = sys.argv[3] cmakeFile = sys.argv[4] - # coreOption = getStringOptionSelection( cmakeFile, "WRF_CORE_OPTIONS" ) - # nestingOption = getStringOptionSelection( cmakeFile, "WRF_NESTING_OPTIONS" ) - # caseOption = getStringOptionSelection( cmakeFile, "WRF_CASE_OPTIONS" ) - - # These are yes - yesValues = [ "yes", "y", "true", "1" ] - - #!TODO Expand this for all wrf options - useMPI = input( "[DM] Use MPI? [Y/n] : " ).lower() in yesValues - useOpenMP = input( "[SM] Use OpenMP? [Y/n] : " ).lower() in yesValues - buildExt = input( "[EXT] Build external? [Y/n] : " ).lower() in yesValues - - fp = open( configFile, 'r' ) lines = fp.read() fp.close() @@ -295,27 +415,66 @@ def main() : stanza = Stanza( stanzaBlock.group(1) ) stanza.parse() - stanzas.append( stanza ) - stanzaConfig = str( stanza ) - stanzaId = "{idx:<3} ".format( idx=stanzaIdx ) - if stanzaConfig not in uniqueConfigs : - uniqueConfigs[ stanzaConfig ] = { "stanza" : stanza, "idx" : stanzaIdx } - print( stanzaId + stanzaConfig + "[first entry]" ) - else : - diff, value = Stanza.findFirstDifference( uniqueConfigs[ stanzaConfig ]["stanza"], stanza ) - if diff : - print( stanzaId + stanzaConfig + "@{idx} diff => {value}".format( idx=uniqueConfigs[ stanzaConfig ][ "idx" ], value=value ) ) - else : - print( stanzaId + stanzaConfig + "[no difference]" ) - stanzaIdx += 1 + if not stanza.crossPlatform_ and stanza.serialCompilersAvailable() and ( stanza.dmCompilersAvailable() or ( stanza.serialOpt_ or stanza.smparOpt_ ) ) : + stanzas.append( stanza ) + stanzaConfig = str( stanza ) + stanzaId = "{idx:<3} ".format( idx=stanzaIdx ) + if stanzaConfig not in uniqueConfigs : + uniqueConfigs[ stanzaConfig ] = { "stanza" : stanza, "idx" : stanzaIdx } + + # Of course WPS configure.defaults is different than WRF so descriptions are embedded in the comments + stanza.kvPairs_[ "DESCRIPTION" ] = stanza.osArchLine_.partition( "," )[ -1 ].partition( "#" )[0].strip() + # "{os:<12} {arch:<12} {desc} stanza.os_ + print( stanzaId + stanzaConfig + stanza.kvPairs_[ "DESCRIPTION" ] ) + # else : + # diff, value = Stanza.findFirstDifference( uniqueConfigs[ stanzaConfig ]["stanza"], stanza ) + # if diff : + # print( stanzaId + stanzaConfig + "@{idx} diff => {value}".format( idx=uniqueConfigs[ stanzaConfig ][ "idx" ], value=value ) ) + # else : + # print( stanzaId + stanzaConfig + "[no difference]" ) + stanzaIdx += 1 - print( "!! - Not recommended for your system" ) + print( "!! - Compiler not found, some configurations will not work and will be hidden" ) idxSelection = int( input( "Select configuration [0-{stop}] (note !!) : ".format( stop=( stanzaIdx-1) ) ) ) if idxSelection < 0 or idxSelection > stanzaIdx - 1 : print( "Invalid configuration selection!" ) exit(1) + stanzaCfg = stanzas[idxSelection] + # coreOption = getStringOptionSelection( cmakeFile, "WRF_CORE_OPTIONS" ) + # nestingOption = getStringOptionSelection( cmakeFile, "WRF_NESTING_OPTIONS" ) + # caseOption = getStringOptionSelection( cmakeFile, "WRF_CASE_OPTIONS" ) + + # These are yes + yesValues = [ "yes", "y", "true", "1" ] + + ############################################################################## + # Decompose the weird way to write the logic for DM/SM + USE_MPI = False + if ( stanzaCfg.serialOpt_ or stanzaCfg.smparOpt_ ) and ( stanzaCfg.dmparOpt_ or stanzaCfg.dmsmOpt_ ) : + # togglable + # we can safely check this since the user would not have been able to select this stanza if it couldn't be disabled + if stanzaCfg.dmCompilersAvailable() : + useMPI = input( "[DM] Use MPI? [Y/n] : " ).lower() in yesValues + else : + useMPI = False + else: + # User has no choice in the matter + useMPI = ( stanzaCfg.dmparOpt_ or stanzaCfg.dmsmOpt_ ) + + useOpenMP = False + if ( stanzaCfg.serialOpt_ or stanzaCfg.dmparOpt_ ) and ( stanzaCfg.smparOpt_ or stanzaCfg.dmsmOpt_ ): + # togglable + useOpenMP = input( "[SM] Use OpenMP? [Y/n] : " ).lower() in yesValues + else: + # User has no choice in the matter + useOpenMP = ( stanzaCfg.smparOpt_ or stanzaCfg.dmsmOpt_ ) + + ############################################################################## + + buildExt = input( "[EXT] Build external? [Y/n] : " ).lower() in yesValues + additionalOptions = { # "WRF_CORE" : coreOption, # "WRF_NESTING" : nestingOption, diff --git a/cmake/template/arch_config.cmake b/cmake/template/arch_config.cmake index b31e022c8..19936025b 100644 --- a/cmake/template/arch_config.cmake +++ b/cmake/template/arch_config.cmake @@ -5,8 +5,8 @@ set( MPI_C_COMPILER "{DM_CC}" ) set( CMAKE_Fortran_COMPILER "{SFC}" ) set( CMAKE_C_COMPILER "{SCC}" ) -set( CMAKE_Fortran_FLAGS_INIT "{FFLAGS}" ) -set( CMAKE_C_FLAGS_INIT "{CFLAGS}" ) +set( CMAKE_Fortran_FLAGS_INIT "{SFC_FLAGS} {FFLAGS}" ) +set( CMAKE_C_FLAGS_INIT "{SCC_FLAGS} {CFLAGS}" ) # set( CMAKE_Fortran_FLAGS_DEBUG_INIT "{{FCDEBUG}}" ) # set( CMAKE_Fortran_FLAGS_RELEASE_INIT "{{FCOPTIM}}" ) From 9c6c4ef02cc799322305a0e83ac6e08b582109dd Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Mon, 31 Jul 2023 14:33:27 -0600 Subject: [PATCH 26/63] Making sure to cd back --- cleanCMake.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cleanCMake.sh b/cleanCMake.sh index 51b140509..9ea2b1800 100755 --- a/cleanCMake.sh +++ b/cleanCMake.sh @@ -51,7 +51,7 @@ fi if [[ "${CLEAN_BASIC_BUILD}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then echo "Doing cmake make clean" OLD_DIR=$PWD - cd ${BUILD_DIR} && make -j 1 clean && cd $OLD_DIR + cd ${BUILD_DIR} && make -j 1 clean; cd $OLD_DIR fi if [[ "${CLEAN_BASIC_INSTALL}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then From 452381d475da5c3338346c76bef7b69b78262b49 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 16 Aug 2023 18:28:48 -0600 Subject: [PATCH 27/63] Removal of obsolete code --- CMakeLists.txt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd5f5e252..76fca3df7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,12 +170,3 @@ install( FILES_MATCHING PATTERN "*.cmake" ) -# install( -# FILES -# ${PROJECT_SOURCE_DIR}/cmake/confcheck.cmake -# ${PROJECT_SOURCE_DIR}/cmake/gitinfo.cmake -# ${PROJECT_SOURCE_DIR}/cmake/printOption.cmake -# ${PROJECT_SOURCE_DIR}/cmake/wrf_get_version.cmake -# COMPONENT helpers -# DESTINATION share -# ) From 75346790d6be7e10ccfc0d714c8a5461bf44f949 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 16 Aug 2023 18:30:17 -0600 Subject: [PATCH 28/63] Allow stanza selection and direct option pass-through without user prompt, useful for automation --- arch/configure_reader.py | 203 +++++++++++++++++++++++++++++---------- configure_new | 77 ++++++++++++--- 2 files changed, 213 insertions(+), 67 deletions(-) diff --git a/arch/configure_reader.py b/arch/configure_reader.py index 18cc532a9..c39668046 100755 --- a/arch/configure_reader.py +++ b/arch/configure_reader.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import argparse import sys import re import inspect @@ -191,9 +192,9 @@ def sanitize( self ) : self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_FDEFS", "" ) self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_MPI", "" ) self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMPAT_FLAGS", "" ) - - compileObject.sub( "\1\2", self.kvPairs_[ keyToSan ] ) - # self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "-c", "" ) + + self.kvPairs_[ keyToSan ] = compileObject.sub( r"\1\2", self.kvPairs_[ keyToSan ] ).strip() + # Now deref all the rest for key in self.kvPairs_ : @@ -275,6 +276,133 @@ def findFirstDifference( rhStanza, lhStanza, maxLength=32 ) : return diff, value +######################################################################################################################## +## +## Option handling +## +######################################################################################################################## +def getOptionsParser() : + parser = argparse.ArgumentParser( ) + + # https://stackoverflow.com/a/24181138 + requiredNamed = parser.add_argument_group( "required named arguments" ) + + requiredNamed.add_argument( + "-c", "--config", + dest="configFile", + help="configure.defaults file holding all stanza configurations", + type=str, + required=True + ) + requiredNamed.add_argument( + "-t", "--template", + dest="cmakeTemplateFile", + help="cmake template file for configuring stanza into cmake syntax", + type=str, + required=True + ) + requiredNamed.add_argument( + "-o", "--output", + dest="outputConfigFile", + help="cmake output toolchain config file for selected stanza", + type=str, + required=True + ) + + parser.add_argument( + "-p", "--preselect", + dest="preselect", + help="Use preselected stanza configuration, if multiple match grabs the first one", + type=str, + default=None + ) + + parser.add_argument( + "-x", "--skipCMakeOptions", + dest="skipCMakeOptions", + help="Skip query of available CMake options", + default=False, + const=True, + action='store_const' + ) + parser.add_argument( + "-s", "--source", + dest="sourceCMakeFile", + help="Required unless -x/--skipCMakeOptions set, project cmake source file used to determine available options", + type=str, + default=None + ) + + return parser + + +class Options(object): + """Empty namespace""" + pass + +######################################################################################################################## +## +## Select stanza to operate on +## +######################################################################################################################## +def selectStanza( options ) : + + fp = open( options.configFile, 'r' ) + lines = fp.read() + fp.close() + + # Now grab the blocks and parse + stanzas = [] + # Gather all stanzas available + for stanzaBlock in archBlock.finditer( lines ) : + stanza = Stanza( stanzaBlock.group(1) ) + stanza.parse() + + if not stanza.crossPlatform_ and stanza.serialCompilersAvailable() and ( stanza.dmCompilersAvailable() or ( stanza.serialOpt_ or stanza.smparOpt_ ) ) : + if "DESCRIPTION" not in stanza.kvPairs_ : + # Of course WPS configure.defaults is different than WRF so descriptions are embedded in the comments + stanza.kvPairs_[ "DESCRIPTION" ] = stanza.osArchLine_.partition( "," )[ -1 ].partition( "#" )[0].strip() + stanzas.append( stanza ) + + idxSelection = 0 + if options.preselect is None : + # Query for selected + stanzaIdx = 0 + uniqueConfigs = {} + for stanza in stanzas : + stanzaConfig = str( stanza ) + stanzaId = "{idx:<3} ".format( idx=stanzaIdx ) + if stanzaConfig not in uniqueConfigs : + uniqueConfigs[ stanzaConfig ] = { "stanza" : stanza, "idx" : stanzaIdx } + + print( stanzaId + stanzaConfig + stanza.kvPairs_[ "DESCRIPTION" ] ) + # else : + # diff, value = Stanza.findFirstDifference( uniqueConfigs[ stanzaConfig ]["stanza"], stanza ) + # if diff : + # print( stanzaId + stanzaConfig + "@{idx} diff => {value}".format( idx=uniqueConfigs[ stanzaConfig ][ "idx" ], value=value ) ) + # else : + # print( stanzaId + stanzaConfig + "[no difference]" ) + stanzaIdx += 1 + print( "!! - Compiler not found, some configurations will not work and will be hidden" ) + idxSelection = int( input( "Select configuration [0-{stop}] (note !!) : ".format( stop=( stanzaIdx-1) ) ) ) + if idxSelection < 0 or idxSelection > stanzaIdx - 1 : + print( "Invalid configuration selection!" ) + exit(1) + else : + for stanza in stanzas : + if options.preselect.lower() in stanza.kvPairs_["DESCRIPTION"].lower() : + print( str( stanza ) + stanza.kvPairs_[ "DESCRIPTION"] ) + break + else : + idxSelection += 1 + if idxSelection == len( stanzas ) : + print( "Error: Stanza configuration with description '{0}' does not exist. Preselect failed.".format( options.preselect ) ) + exit(1) + + stanzaCfg = stanzas[idxSelection] + + return stanzaCfg + ######################################################################################################################## ## ## Select enum-like string for string-based cmake options @@ -355,6 +483,24 @@ def getSubOptions( topLevelCmake, ignoreOptions ) : return subOptions +def main() : + + parser = getOptionsParser() + options = Options() + parser.parse_args( namespace=options ) + + stanzaCfg = selectStanza( options ) + + additionalOptions = {} + if not options.skipCMakeOptions : + if options.sourceCMakeFile is None : + print( "Error: Project source cmake file required for project specific options." ) + exit(1) + else: + additionalOptions = projectSpecificOptions( options, stanzaCfg ) + + generateCMakeToolChainFile( options.cmakeTemplateFile, options.outputConfigFile, stanzaCfg, additionalOptions ) + ######################################################################################################################## ######################################################################################################################## ## @@ -397,55 +543,8 @@ def generateCMakeToolChainFile( cmakeToolChainTemplate, output, stanza, optionsD outputFP.write( configStanza ) outputFP.close() -def main() : - configFile = sys.argv[1] - cmakeTemplateFile = sys.argv[2] - cmakeConfigFile = sys.argv[3] - cmakeFile = sys.argv[4] - - fp = open( configFile, 'r' ) - lines = fp.read() - fp.close() - - # Now grab the blocks and parse - stanzas = [] - uniqueConfigs = {} - stanzaIdx = 0 - for stanzaBlock in archBlock.finditer( lines ) : - stanza = Stanza( stanzaBlock.group(1) ) - stanza.parse() +def projectSpecificOptions( options, stanzaCfg ) : - if not stanza.crossPlatform_ and stanza.serialCompilersAvailable() and ( stanza.dmCompilersAvailable() or ( stanza.serialOpt_ or stanza.smparOpt_ ) ) : - stanzas.append( stanza ) - stanzaConfig = str( stanza ) - stanzaId = "{idx:<3} ".format( idx=stanzaIdx ) - if stanzaConfig not in uniqueConfigs : - uniqueConfigs[ stanzaConfig ] = { "stanza" : stanza, "idx" : stanzaIdx } - - # Of course WPS configure.defaults is different than WRF so descriptions are embedded in the comments - stanza.kvPairs_[ "DESCRIPTION" ] = stanza.osArchLine_.partition( "," )[ -1 ].partition( "#" )[0].strip() - # "{os:<12} {arch:<12} {desc} stanza.os_ - print( stanzaId + stanzaConfig + stanza.kvPairs_[ "DESCRIPTION" ] ) - # else : - # diff, value = Stanza.findFirstDifference( uniqueConfigs[ stanzaConfig ]["stanza"], stanza ) - # if diff : - # print( stanzaId + stanzaConfig + "@{idx} diff => {value}".format( idx=uniqueConfigs[ stanzaConfig ][ "idx" ], value=value ) ) - # else : - # print( stanzaId + stanzaConfig + "[no difference]" ) - stanzaIdx += 1 - - print( "!! - Compiler not found, some configurations will not work and will be hidden" ) - - idxSelection = int( input( "Select configuration [0-{stop}] (note !!) : ".format( stop=( stanzaIdx-1) ) ) ) - if idxSelection < 0 or idxSelection > stanzaIdx - 1 : - print( "Invalid configuration selection!" ) - exit(1) - - stanzaCfg = stanzas[idxSelection] - # coreOption = getStringOptionSelection( cmakeFile, "WRF_CORE_OPTIONS" ) - # nestingOption = getStringOptionSelection( cmakeFile, "WRF_NESTING_OPTIONS" ) - # caseOption = getStringOptionSelection( cmakeFile, "WRF_CASE_OPTIONS" ) - # These are yes yesValues = [ "yes", "y", "true", "1" ] @@ -483,8 +582,8 @@ def main() : "USE_MPI" : "ON" if useMPI else "OFF", "BUILD_EXTERNALS" : "ON" if buildExt else "OFF" } - generateCMakeToolChainFile( cmakeTemplateFile, cmakeConfigFile, stanzas[idxSelection], additionalOptions ) + return additionalOptions diff --git a/configure_new b/configure_new index 96368fdc9..c0d4cb3a8 100755 --- a/configure_new +++ b/configure_new @@ -1,18 +1,65 @@ #!/bin/sh -# Meant to be run at the top level -./arch/configure_reader.py \ - arch/configure.defaults \ - cmake/template/arch_config.cmake \ - wps_config.cmake \ - CMakeLists.txt - -WRF_DIR= -if [ ! -z $1 ]; then - WRF_DIR=-DWRF_DIR="$1" + +function help() +{ + echo "./configure_new [options] [-- ]" + echo " -p Preselect a stanza configuration with matching description" + echo " -x Skip CMake options prompt, meant to be used in conjunction with direct pass-in options" + echo " -- Directly pass CMake options to configuration, equivalent to cmake " + echo " -h Print this message" + +} + +preselect= +skipCMake=false +while getopts p:xh opt; do + case $opt in + p) + preselect=$OPTARG + ;; + x) + skipCMake=true + ;; + h) help; exit 0 ;; + *) help; exit 1 ;; + :) help; exit 1 ;; + \?) help; exit 1 ;; + esac +done + +shift "$((OPTIND - 1))" + +extraOps= +if [ $skipCMake = true ]; then + extraOps="-x" +else + extraOps="-s CMakeLists.txt" fi -# Now run cmake -mkdir -p _build/ -cd _build -cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../run -DCMAKE_TOOLCHAIN_FILE=$PWD/..//wps_config.cmake ${WRF_DIR} -# cmake -S . -B _build \ No newline at end of file + +if [ ! -z "$preselect" ]; then + echo "Using preselected config ${preselect}" + # Meant to be run at the top level + ./arch/configure_reader.py \ + -c arch/configure.defaults \ + -t cmake/template/arch_config.cmake \ + -o wps_config.cmake \ + ${extraOps} -p "${preselect}" +else + # Meant to be run at the top level + ./arch/configure_reader.py \ + -c arch/configure.defaults \ + -t cmake/template/arch_config.cmake \ + -o wps_config.cmake \ + ${extraOps} +fi + +configureStanza=$? + +if [ $configureStanza -eq 0 ]; then + # Now run cmake + mkdir -p _build/ + cd _build + cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../runTemp -DCMAKE_TOOLCHAIN_FILE=$PWD/../wps_config.cmake $* + # cmake -S . -B _build +fi \ No newline at end of file From d3260574985da897166600e5ee5bff76a803f0c3 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 6 Sep 2023 14:58:17 -0600 Subject: [PATCH 29/63] Ignoring the plethora of files generated --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 3979058db..330b89caf 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,7 @@ run/ _build/ # Compiled GRIB2 libraries if --build-grib2-libs option is given to configure script grib2 +*.nc +GRIBFILE.* +*.o +FILE:* \ No newline at end of file From 75231765ffec71c0ba414149dd29c9bfc12bba05 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 6 Sep 2023 14:58:51 -0600 Subject: [PATCH 30/63] sh compliant --- cleanCMake.sh | 12 ++++++------ configure_new | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cleanCMake.sh b/cleanCMake.sh index 9ea2b1800..a33c54c94 100755 --- a/cleanCMake.sh +++ b/cleanCMake.sh @@ -3,7 +3,7 @@ BUILD_DIR=_build INSTALL_DIR=run TEST_DIR=test/ -function help() +help() { echo "./cleanCMake.sh [options]" echo " -c Basic cmake clean functionality [cmake --build ${BUILD_DIR} -j 1 --target clean]" @@ -43,28 +43,28 @@ while getopts "hcilfa" opt; do esac done -if [[ $OPTIND -eq 1 ]]; then +if [ $OPTIND -eq 1 ]; then # Do basic clean I guess CLEAN_BASIC_BUILD=TRUE fi -if [[ "${CLEAN_BASIC_BUILD}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then +if [ "${CLEAN_BASIC_BUILD}" = "TRUE" ] || [ "${CLEAN_ALL}" = "TRUE" ]; then echo "Doing cmake make clean" OLD_DIR=$PWD cd ${BUILD_DIR} && make -j 1 clean; cd $OLD_DIR fi -if [[ "${CLEAN_BASIC_INSTALL}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then +if [ "${CLEAN_BASIC_INSTALL}" = "TRUE" ] || [ "${CLEAN_ALL}" = "TRUE" ]; then echo "Removing binary installs" xargs rm < ${BUILD_DIR}/install_manifest.txt fi -# if [[ "${CLEAN_LINKS}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then +# if [ "${CLEAN_LINKS}" = "TRUE" ] || [ "${CLEAN_ALL}" = "TRUE" ]; then # echo "Removing all symlinks in ${TEST_DIR}" # find ${TEST_DIR} -type l -exec rm {} \; # fi -if [[ "${CLEAN_FOLDERS}" == "TRUE" || "${CLEAN_ALL}" == "TRUE" ]]; then +if [ "${CLEAN_FOLDERS}" = "TRUE" ] || [ "${CLEAN_ALL}" = "TRUE" ]; then echo "Deleting ${BUILD_DIR} & ${INSTALL_DIR}/" rm ${BUILD_DIR} -r; rm ${INSTALL_DIR}/ -r fi \ No newline at end of file diff --git a/configure_new b/configure_new index c0d4cb3a8..914871ace 100755 --- a/configure_new +++ b/configure_new @@ -1,6 +1,6 @@ #!/bin/sh -function help() +help() { echo "./configure_new [options] [-- ]" echo " -p Preselect a stanza configuration with matching description" @@ -60,6 +60,6 @@ if [ $configureStanza -eq 0 ]; then # Now run cmake mkdir -p _build/ cd _build - cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../runTemp -DCMAKE_TOOLCHAIN_FILE=$PWD/../wps_config.cmake $* + cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../run -DCMAKE_TOOLCHAIN_FILE=$PWD/../wps_config.cmake $* # cmake -S . -B _build fi \ No newline at end of file From ebea3e8f8c26ff9605b34c5441bfd79727382150 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 6 Sep 2023 14:59:07 -0600 Subject: [PATCH 31/63] Aligning with WRF --- arch/configure_reader.py | 60 ++++++++++++++++++++++---------- cmake/template/arch_config.cmake | 13 +++++-- 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/arch/configure_reader.py b/arch/configure_reader.py index c39668046..78fa3cabc 100755 --- a/arch/configure_reader.py +++ b/arch/configure_reader.py @@ -2,6 +2,7 @@ import argparse import sys +import os import re import inspect import platform @@ -76,29 +77,45 @@ def parse( self ) : ###################################################################################################################### def dereference( self, field, fatal=False ) : # print( "Dereferencing " + field ) + if field in self.kvPairs_ : prevField = self.kvPairs_[field] for refVarIter in referenceVar.finditer( prevField ) : + envSub = None + if refVarIter is not None : # Grab group 1 and check that it is in our kv pairs refVar = refVarIter.group(2) # print( "Found variable {0} in field {1}".format( refVar, field ) ) if refVar not in self.kvPairs_ : - if fatal : - # print( "Could not rereference : " + refVar ) - exit(1) + # Try to use the environment variables + if refVar in os.environ : + envSub = os.environ[ refVar ] else: - continue - - # Recursively deref - self.dereference( refVar, fatal ) + if fatal : + # print( "Could not rereference : " + refVar ) + exit(1) + else: + continue + - # Replace in original - self.kvPairs_[field] = self.kvPairs_[field].replace( - "{var}".format( var=refVarIter.group(0) ), - self.kvPairs_[refVar] - ) + # This is an environment variable + if envSub is not None : + self.kvPairs_[field] = self.kvPairs_[field].replace( + "{var}".format( var=refVarIter.group(0) ), + envSub + ) + # This is a kv pair, recurse + else : + # Recursively deref + self.dereference( refVar, fatal ) + + # Replace in original + self.kvPairs_[field] = self.kvPairs_[field].replace( + "{var}".format( var=refVarIter.group(0) ), + self.kvPairs_[refVar] + ) def removeReferences( self, field, specifics=[] ) : if field in self.kvPairs_ : @@ -142,13 +159,6 @@ def sanitize( self ) : # # Now deref self.dereference( "FCBASEOPTS" ) - # Now fix certain ones that are mixing programs with flags all mashed into one option - self.splitIntoFieldAndFlags( "SFC" ) - self.splitIntoFieldAndFlags( "SCC" ) - self.splitIntoFieldAndFlags( "DM_FC" ) - self.splitIntoFieldAndFlags( "DM_CC" ) - self.splitIntoFieldAndFlags( "M4" ) - # Remove rogue compile commands that should *NOT* even be here keysToSanitize = [ "ARFLAGS","ARFLAGS", @@ -192,10 +202,20 @@ def sanitize( self ) : self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_FDEFS", "" ) self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_MPI", "" ) self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMPAT_FLAGS", "" ) + self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_CPPFLAGS", "" ) + self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_TRADFLAG", "" ) self.kvPairs_[ keyToSan ] = compileObject.sub( r"\1\2", self.kvPairs_[ keyToSan ] ).strip() + # Now fix certain ones that are mixing programs with flags all mashed into one option + self.splitIntoFieldAndFlags( "SFC" ) + self.splitIntoFieldAndFlags( "SCC" ) + self.splitIntoFieldAndFlags( "DM_FC" ) + self.splitIntoFieldAndFlags( "DM_CC" ) + self.splitIntoFieldAndFlags( "CPP" ) + self.splitIntoFieldAndFlags( "M4" ) + # Now deref all the rest for key in self.kvPairs_ : self.dereference( key ) @@ -516,7 +536,9 @@ def generateCMakeToolChainFile( cmakeToolChainTemplate, output, stanza, optionsD cmakeToolChainTemplateFP.close() configStanza = cmakeToolChainTemplateLines.format( + CPP=stanza.kvPairs_["CPP"], CPPFLAGS=stanza.kvPairs_["CPPFLAGS"], + CPP_FLAGS=stanza.kvPairs_["CPP_FLAGS"], # BYTESWAPIO=stanza.kvPairs_["BYTESWAPIO"], CFLAGS=stanza.kvPairs_["CFLAGS"], FFLAGS=stanza.kvPairs_["FFLAGS"], diff --git a/cmake/template/arch_config.cmake b/cmake/template/arch_config.cmake index 19936025b..a4b5a4628 100644 --- a/cmake/template/arch_config.cmake +++ b/cmake/template/arch_config.cmake @@ -2,14 +2,23 @@ set( MPI_Fortran_COMPILER "{DM_FC}" ) set( MPI_C_COMPILER "{DM_CC}" ) +# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html set( CMAKE_Fortran_COMPILER "{SFC}" ) set( CMAKE_C_COMPILER "{SCC}" ) +# Our own addition +set( CMAKE_C_PREPROCESSOR "{CPP}" ) +set( CMAKE_C_PREPROCESSOR_FLAGS {CPP_FLAGS} ) + +# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS_INIT.html set( CMAKE_Fortran_FLAGS_INIT "{SFC_FLAGS} {FFLAGS}" ) set( CMAKE_C_FLAGS_INIT "{SCC_FLAGS} {CFLAGS}" ) -# set( CMAKE_Fortran_FLAGS_DEBUG_INIT "{{FCDEBUG}}" ) -# set( CMAKE_Fortran_FLAGS_RELEASE_INIT "{{FCOPTIM}}" ) +# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS_CONFIG_INIT.html +set( CMAKE_Fortran_FLAGS_DEBUG_INIT "" ) +set( CMAKE_Fortran_FLAGS_RELEASE_INIT "" ) +set( CMAKE_C_FLAGS_DEBUG_INIT "" ) +set( CMAKE_C_FLAGS_RELEASE_INIT "" ) # Project specifics now set( WPS_MPI_Fortran_FLAGS "{DM_FC_FLAGS}" ) From 855bbb481bc8f71253ef9f1db73f780bf8d9f132 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 6 Sep 2023 14:59:36 -0600 Subject: [PATCH 32/63] Splitting defs in case we ever need to handle them differently --- CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76fca3df7..9d9df3d34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,11 +100,25 @@ find_package( Jasper REQUIRED ) # Add config definitions message( STATUS "Adding configuration specific definitions : ${WPS_DEFINITIONS}" ) -# In CMake 2.26 this will not be necessary + string( REPLACE " " ";" WPS_DEFINITIONS_LIST ${WPS_DEFINITIONS} ) + +# Make a copy, filter for anything not -D +set( WPS_UNDEFINITIONS_LIST ${WPS_DEFINITIONS_LIST} ) +list( FILTER WPS_UNDEFINITIONS_LIST EXCLUDE REGEX "^-D(.*)" ) + +# Add this to the cpp processing +list( APPEND CMAKE_C_PREPROCESSOR_FLAGS ${WPS_UNDEFINITIONS_LIST} ) + +# Filter for anything that is -D +list( FILTER WPS_DEFINITIONS_LIST INCLUDE REGEX "^-D(.*)" ) + +# In CMake 2.26 this will not be necessary list( TRANSFORM WPS_DEFINITIONS_LIST REPLACE "^-D(.*)" "\\1" ) + add_compile_definitions( ${WPS_DEFINITIONS_LIST} + ${WPS_UNDEFINITIONS_LIST} $<$:USE_JPEG2000> $<$:USE_PNG> ) From 64dc5da457213f1e84865e96ea3cb9dbd564092f Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 31 Jan 2024 18:03:11 -0700 Subject: [PATCH 33/63] Sync with WRF --- cleanCMake.sh | 71 +++++++++++++++++++++++++-------------------------- compile_new | 11 ++++++-- configure_new | 34 +++++++++++++++++++----- 3 files changed, 71 insertions(+), 45 deletions(-) diff --git a/cleanCMake.sh b/cleanCMake.sh index a33c54c94..06c3a38a8 100755 --- a/cleanCMake.sh +++ b/cleanCMake.sh @@ -1,40 +1,44 @@ #!/bin/sh -BUILD_DIR=_build -INSTALL_DIR=run -TEST_DIR=test/ +buildDirectory=_build +installDirectory=install help() { echo "./cleanCMake.sh [options]" - echo " -c Basic cmake clean functionality [cmake --build ${BUILD_DIR} -j 1 --target clean]" - echo " -i Remove cmake binary installs [xargs rm < ${BUILD_DIR}/install_manifest.txt]" - # echo " -l Remove symlinks (WPS) [ find ${TEST_DIR} -type l -exec rm {} \; ]" - echo " -f Remove build & install folders (WPS) [ rm ${BUILD_DIR} -r; rm ${INSTALL_DIR}/ -r ]" - echo " -a Remove all (WPS), equivalent to -f (more specifically -c -i -f)" + echo " -c [Default if no options] Basic cmake clean functionality [make -j 1 clean]" + echo " -b Remove cmake binary installs [xargs rm < ${buildDirectory}/install_manifest.txt]" + echo " -f Remove build & install folders (WRF) [ rm ${buildDirectory} -r; rm ${installDirectory}/ -r ]" + echo " -a Remove all (WRF), equivalent to -c -b -f (more specifically -c then -b then-f)" + echo "Specific builds/installs" + echo " -d directory Specify operating on particular build directory" + echo " -i directory Specify operating on particular install directory" } -CLEAN_BASIC_BUILD=FALSE -CLEAN_BASIC_INSTALL=FALSE -CLEAN_LINKS=FALSE -CLEAN_FOLDERS=FALSE -CLEAN_ALL=FALSE +cleanBasicBuild=FALSE +cleanBasicInstall=FALSE +cleanLinks=FALSE +cleanFolders=FALSE +cleanAll=FALSE -while getopts "hcilfa" opt; do +while getopts "hcbfad:i:" opt; do case ${opt} in c) - CLEAN_BASIC_BUILD=TRUE + cleanBasicBuild=TRUE ;; - i) - CLEAN_BASIC_INSTALL=TRUE - ;; - l) - CLEAN_LINKS=TRUE + b) + cleanBasicInstall=TRUE ;; f) - CLEAN_FOLDERS=TRUE + cleanFolders=TRUE ;; a) - CLEAN_ALL=TRUE + cleanAll=TRUE + ;; + d) + buildDirectory=$OPTARG + ;; + i) + installDirectory=$OPTARG ;; h) help; exit 0 ;; *) help; exit 1 ;; @@ -45,26 +49,21 @@ done if [ $OPTIND -eq 1 ]; then # Do basic clean I guess - CLEAN_BASIC_BUILD=TRUE + cleanBasicBuild=TRUE fi -if [ "${CLEAN_BASIC_BUILD}" = "TRUE" ] || [ "${CLEAN_ALL}" = "TRUE" ]; then +if [ "${cleanBasicBuild}" = "TRUE" ] || [ "${cleanAll}" = "TRUE" ]; then echo "Doing cmake make clean" OLD_DIR=$PWD - cd ${BUILD_DIR} && make -j 1 clean; cd $OLD_DIR + cd ${buildDirectory} && make -j 1 clean > /dev/null 2>&1; cd $OLD_DIR fi -if [ "${CLEAN_BASIC_INSTALL}" = "TRUE" ] || [ "${CLEAN_ALL}" = "TRUE" ]; then +if [ "${cleanBasicInstall}" = "TRUE" ] || [ "${cleanAll}" = "TRUE" ]; then echo "Removing binary installs" - xargs rm < ${BUILD_DIR}/install_manifest.txt + xargs rm < ${buildDirectory}/install_manifest.txt > /dev/null 2>&1 fi -# if [ "${CLEAN_LINKS}" = "TRUE" ] || [ "${CLEAN_ALL}" = "TRUE" ]; then -# echo "Removing all symlinks in ${TEST_DIR}" -# find ${TEST_DIR} -type l -exec rm {} \; -# fi - -if [ "${CLEAN_FOLDERS}" = "TRUE" ] || [ "${CLEAN_ALL}" = "TRUE" ]; then - echo "Deleting ${BUILD_DIR} & ${INSTALL_DIR}/" - rm ${BUILD_DIR} -r; rm ${INSTALL_DIR}/ -r -fi \ No newline at end of file +if [ "${cleanFolders}" = "TRUE" ] || [ "${cleanAll}" = "TRUE" ]; then + echo "Deleting ${buildDirectory} & ${installDirectory}/" + rm ${buildDirectory} -r; rm ${installDirectory}/ -r > /dev/null 2>&1 +fi diff --git a/compile_new b/compile_new index 121f83537..721df9d3b 100755 --- a/compile_new +++ b/compile_new @@ -2,5 +2,12 @@ # Meant to be run at the top level # Now run cmake -cd _build && make install $* -# cmake --build _build --target install $* \ No newline at end of file +buildDirectory=$1 +if [ ! -d "$buildDirectory" ]; then + buildDirectory=$PWD/_build + echo "Using default build directory : ${buildDirectory}" +else + shift +fi +cd $buildDirectory && make install $* +exit $? \ No newline at end of file diff --git a/configure_new b/configure_new index 914871ace..16c782b9e 100755 --- a/configure_new +++ b/configure_new @@ -5,6 +5,8 @@ help() echo "./configure_new [options] [-- ]" echo " -p Preselect a stanza configuration with matching description" echo " -x Skip CMake options prompt, meant to be used in conjunction with direct pass-in options" + echo " -d directory Use as alternate build directory" + echo " -i directory Use as alternate install directory" echo " -- Directly pass CMake options to configuration, equivalent to cmake " echo " -h Print this message" @@ -12,7 +14,7 @@ help() preselect= skipCMake=false -while getopts p:xh opt; do +while getopts p:xd:i:h opt; do case $opt in p) preselect=$OPTARG @@ -20,6 +22,12 @@ while getopts p:xh opt; do x) skipCMake=true ;; + d) + buildDirectory=$OPTARG + ;; + i) + installDirectory=$OPTARG + ;; h) help; exit 0 ;; *) help; exit 1 ;; :) help; exit 1 ;; @@ -36,6 +44,17 @@ else extraOps="-s CMakeLists.txt" fi +if [ -z "$buildDirectory" ]; then + buildDirectory=_build + echo "Using default build directory : $buildDirectory" +fi +if [ -z "$installDirectory" ]; then + installDirectory=$PWD/install + echo "Using default install directory : $installDirectory" +fi + +mkdir -p $buildDirectory + if [ ! -z "$preselect" ]; then echo "Using preselected config ${preselect}" @@ -43,14 +62,14 @@ if [ ! -z "$preselect" ]; then ./arch/configure_reader.py \ -c arch/configure.defaults \ -t cmake/template/arch_config.cmake \ - -o wps_config.cmake \ + -o $buildDirectory/wps_config.cmake \ ${extraOps} -p "${preselect}" else # Meant to be run at the top level ./arch/configure_reader.py \ -c arch/configure.defaults \ -t cmake/template/arch_config.cmake \ - -o wps_config.cmake \ + -o $buildDirectory/wps_config.cmake \ ${extraOps} fi @@ -58,8 +77,9 @@ configureStanza=$? if [ $configureStanza -eq 0 ]; then # Now run cmake - mkdir -p _build/ - cd _build - cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../run -DCMAKE_TOOLCHAIN_FILE=$PWD/../wps_config.cmake $* - # cmake -S . -B _build + cd $buildDirectory + cmake .. -DCMAKE_INSTALL_PREFIX=$installDirectory -DCMAKE_TOOLCHAIN_FILE=$buildDirectory/wps_config.cmake $* + exit $? +else + exit $configureStanza fi \ No newline at end of file From bb9ff2e2be97d39f4d3fed618510fb37ba73a6f9 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 31 Jan 2024 18:04:16 -0700 Subject: [PATCH 34/63] Sync netCDF modules with WRF --- cmake/modules/FindnetCDF-Fortran.cmake | 89 ++++++++++++++++++++++++++ cmake/modules/FindnetCDF.cmake | 43 +++++++++---- 2 files changed, 118 insertions(+), 14 deletions(-) create mode 100644 cmake/modules/FindnetCDF-Fortran.cmake diff --git a/cmake/modules/FindnetCDF-Fortran.cmake b/cmake/modules/FindnetCDF-Fortran.cmake new file mode 100644 index 000000000..0ead239a5 --- /dev/null +++ b/cmake/modules/FindnetCDF-Fortran.cmake @@ -0,0 +1,89 @@ +# Find netcdf +# Eventually replace with netCDF-Fortran's actual config if using that +# Once found this file will define: +# netCDF-Fortran_FOUND - System has netcdf +# netCDF-Fortran_INCLUDE_DIRS - The netcdf include directories +# netCDF-Fortran_LIBRARIES - The libraries needed to use netcdf +# netCDF-Fortran_DEFINITIONS - Compiler switches required for using netcdf + +# list( REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} ) +# find_package( netCDF-Fortran ) +# list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} ) + + +# exit early if we don't even need to be here +if ( netCDF-Fortran_FOUND ) + return() +endif() + +############################################################################### +# First try to find using netCDF-Fortran native cmake build +# TODO : Enable this when netCDF-Fortran native cmake build works well as an imported package +# find_package( netCDF-Fortran CONFIG ) +# if ( netCDF-Fortran_FOUND ) +# message( STATUS "Found netCDF-Fortran through native cmake build" ) +# return() +# endif() +############################################################################### + +# else +# Use nf-config +find_program( + NETCDF-FORTRAN_PROGRAM + nf-config + QUIET + ) + +if ( ${NETCDF-FORTRAN_PROGRAM} MATCHES "-NOTFOUND$" ) + message( STATUS "No nf-config found" ) +else() + message( STATUS "Found NETCDF-FORTRAN_PROGRAM : ${NETCDF-FORTRAN_PROGRAM}" ) + + execute_process( COMMAND ${NETCDF-FORTRAN_PROGRAM} --includedir OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF-Fortran_INCLUDE_DIR ) + execute_process( COMMAND ${NETCDF-FORTRAN_PROGRAM} --prefix OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF-Fortran_PREFIX ) + execute_process( COMMAND ${NETCDF-FORTRAN_PROGRAM} --flibs OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF-Fortran_FLIBS ) + execute_process( COMMAND ${NETCDF-FORTRAN_PROGRAM} --version OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF-Fortran_VERSION_RAW ) + execute_process( COMMAND ${NETCDF-FORTRAN_PROGRAM} --has-nc4 OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF-Fortran_NC4_YES ) + + # check for large file support + find_file( netCDF-Fortran_INCLUDE_FILE netcdf.inc ${netCDF-Fortran_INCLUDE_DIR} ) + file( READ ${netCDF-Fortran_INCLUDE_FILE} netCDF-Fortran_INCLUDE_FILE_STR ) + string( FIND "${netCDF-Fortran_INCLUDE_FILE_STR}" "nf_format_64bit_data" netCDF-Fortran_LARGE_FILE_SUPPORT_FOUND ) + if ( ${netCDF-Fortran_LARGE_FILE_SUPPORT_FOUND} EQUAL -1 ) + set( netCDF-Fortran_LARGE_FILE_SUPPORT "NO" ) + else() + set( netCDF-Fortran_LARGE_FILE_SUPPORT "YES" ) + endif() + + # Sanitize version + string( REPLACE " " ";" netCDF-Fortran_VERSION_LIST ${netCDF-Fortran_VERSION_RAW} ) + list( GET netCDF-Fortran_VERSION_LIST -1 netCDF-Fortran_VERSION ) + + # Convert to YES/NO - Note cannot be generator expression if you want to use it during configuration time + string( TOUPPER ${netCDF-Fortran_NC4_YES} netCDF-Fortran_NC4 ) + + set( netCDF-Fortran_DEFINITIONS ) + set( netCDF-Fortran_LIBRARY_DIR ${netCDF-Fortran_PREFIX}/lib ) + + set( netCDF-Fortran_LIBRARIES + $<$:${netCDF-Fortran_FLIBS}> + ) + + # Because we may need this for in-situ manual preprocessing do not use genex + set( netCDF-Fortran_INCLUDE_DIRS ${netCDF-Fortran_INCLUDE_DIR} ) +endif() + +find_package( PkgConfig ) + +include(FindPackageHandleStandardArgs) + +# handle the QUIETLY and REQUIRED arguments and set netCDF-Fortran_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args( + netCDF-Fortran DEFAULT_MSG + netCDF-Fortran_INCLUDE_DIRS + netCDF-Fortran_FLIBS + netCDF-Fortran_VERSION + ) + +mark_as_advanced( netCDF-Fortran_FLIBS netCDF-Fortran_PREFIX netCDF-Fortran_LIBRARY_DIR ) \ No newline at end of file diff --git a/cmake/modules/FindnetCDF.cmake b/cmake/modules/FindnetCDF.cmake index 6768e2aae..518ec9534 100644 --- a/cmake/modules/FindnetCDF.cmake +++ b/cmake/modules/FindnetCDF.cmake @@ -10,6 +10,24 @@ # find_package( netCDF ) # list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} ) +# exit early if we don't even need to be here +if ( netCDF_FOUND ) + return() +endif() + + +############################################################################### +# First try to find using netCDF native cmake build +# TODO : Enable this when netCDF native cmake build works well as an imported package +# find_package( netCDF CONFIG ) +# if ( netCDF_FOUND ) +# message( STATUS "Found netCDF through native cmake build" ) +# return() +# endif() +############################################################################### + + +# else # Use nc-config find_program( NETCDF_PROGRAM @@ -26,17 +44,15 @@ else() execute_process( COMMAND ${NETCDF_PROGRAM} --libdir OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_LIBRARY_DIR ) execute_process( COMMAND ${NETCDF_PROGRAM} --prefix OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_PREFIX ) execute_process( COMMAND ${NETCDF_PROGRAM} --libs OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_CLIBS ) - execute_process( COMMAND ${NETCDF_PROGRAM} --cxx4libs OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_CXXLIBS ) - execute_process( COMMAND ${NETCDF_PROGRAM} --flibs OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_FLIBS ) execute_process( COMMAND ${NETCDF_PROGRAM} --version OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_VERSION_RAW ) execute_process( COMMAND ${NETCDF_PROGRAM} --has-nc4 OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_NC4_YES ) execute_process( COMMAND ${NETCDF_PROGRAM} --has-pnetcdf OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_PNETCDF_YES ) execute_process( COMMAND ${NETCDF_PROGRAM} --has-parallel OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF_PARALLEL_YES ) # check for large file support - find_file( netCDF_INCLUDE_FILE netcdf.inc ${netCDF_INCLUDE_DIR} ) + find_file( netCDF_INCLUDE_FILE netcdf.h ${netCDF_INCLUDE_DIR} ) file( READ ${netCDF_INCLUDE_FILE} netCDF_INCLUDE_FILE_STR ) - string( FIND "${netCDF_INCLUDE_FILE_STR}" "nf_format_64bit" netCDF_LARGE_FILE_SUPPORT_FOUND ) + string( FIND "${netCDF_INCLUDE_FILE_STR}" "NC_FORMAT_64BIT_DATA" netCDF_LARGE_FILE_SUPPORT_FOUND ) if ( ${netCDF_LARGE_FILE_SUPPORT_FOUND} EQUAL -1 ) set( netCDF_LARGE_FILE_SUPPORT "NO" ) else() @@ -55,10 +71,11 @@ else() set( netCDF_DEFINITIONS ) set( netCDF_LIBRARIES - $<$:${netCDF_CLIBS}> - $<$:${netCDF_CXXLIBS}> - $<$:${netCDF_FLIBS}> + # All supported language variants will need this regardless - this may conflict with the RPATH in any + # supplemental packages so be careful to use compatible langauge versions of netCDF + $<$,$>:${netCDF_CLIBS}> ) + # Because we may need this for in-situ manual preprocessing do not use genex set( netCDF_INCLUDE_DIRS ${netCDF_INCLUDE_DIR} ) endif() @@ -69,12 +86,10 @@ include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set netCDF_FOUND to TRUE # if all listed variables are TRUE find_package_handle_standard_args( netCDF DEFAULT_MSG - netCDF_INCLUDE_DIRS - netCDF_LIBRARY_DIR - netCDF_CLIBS - # netCDF_CXXLIBS - netCDF_FLIBS - netCDF_VERSION + netCDF_INCLUDE_DIRS + netCDF_LIBRARY_DIR + netCDF_CLIBS + netCDF_VERSION ) -mark_as_advanced( netCDF_CLIBS netCDF_CXXLIBS netCDF_FLIBS netCDF_PREFIX netCDF_LIBRARY_DIR ) \ No newline at end of file +mark_as_advanced( netCDF_CLIBS netCDF_PREFIX netCDF_LIBRARY_DIR ) \ No newline at end of file From 0f97d8a9cb97c3f6cfd48baca14e0b0c99024119 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 31 Jan 2024 18:04:53 -0700 Subject: [PATCH 35/63] Use WRF better Jasper module for control of versioning --- CMakeLists.txt | 2 +- cmake/modules/FindJasper.cmake | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d9df3d34..aa20be5cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ endif() # rather than finding our external thirdparty libraries first find_package( ZLIB REQUIRED ) find_package( PNG REQUIRED ) -find_package( Jasper REQUIRED ) +find_package( Jasper 1.900.1...<1.900.24 REQUIRED ) # Add config definitions message( STATUS "Adding configuration specific definitions : ${WPS_DEFINITIONS}" ) diff --git a/cmake/modules/FindJasper.cmake b/cmake/modules/FindJasper.cmake index 3b9bc6210..541ecf214 100644 --- a/cmake/modules/FindJasper.cmake +++ b/cmake/modules/FindJasper.cmake @@ -25,6 +25,11 @@ find_library( PATH_SUFFIXES lib ) +# Ripped from https://github.com/Kitware/CMake/blob/master/Modules/FindJasper.cmake +if( Jasper_INCLUDE_DIR AND EXISTS "${Jasper_INCLUDE_DIR}/jasper/jas_config.h") + file(STRINGS "${Jasper_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*") + string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" Jasper_VERSION_STRING "${jasper_version_str}") +endif() # set(CMAKE_FIND_DEBUG_MODE FALSE) include(FindPackageHandleStandardArgs) @@ -34,7 +39,8 @@ find_package_handle_standard_args( REQUIRED_VARS Jasper_LIBRARY Jasper_INCLUDE_DIR - # VERSION_VAR Jasper_VERSION + VERSION_VAR Jasper_VERSION_STRING + HANDLE_VERSION_RANGE ) if ( Jasper_FOUND AND NOT TARGET Jasper::Jasper ) From 0b3067a0739bbcf4e6ee9f4206bbb09583021e15 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 31 Jan 2024 18:06:03 -0700 Subject: [PATCH 36/63] Better control over finding WRF --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa20be5cd..df9b82850 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,8 +9,8 @@ project( WPS ) set( EXPORT_NAME ${PROJECT_NAME} ) set( INTERNAL_GRIB2_PATH ${CMAKE_INSTALL_PREFIX}/grib2 ) -if ( NOT DEFINED WRF_DIR ) - message( STATUS "No WRF_DIR provided, skipping targets that rely on WRF" ) +if ( NOT DEFINED WRF_DIR AND NOT DEFINED WRF_ROOT ) + message( STATUS "No WRF_DIR or WRF_ROOT provided, skipping targets that rely on WRF" ) endif() list( APPEND CMAKE_MODULE_PATH @@ -87,8 +87,11 @@ endif() # Now find required libraries, which may have been affected by externals -if ( DEFINED WRF_DIR ) - find_package( WRF COMPONENTS WRF_Core io_netcdf io_grib1 io_int HINTS ${WRF_DIR}/lib ) +if ( DEFINED WRF_DIR OR DEFINED WRF_ROOT ) + find_package( WRF COMPONENTS WRF_Core io_netcdf io_grib1 io_int REQUIRED ) + if ( ${WRF_FOUND} ) + message( STATUS "Found WRF : ${WRF_CONFIG} (found version \"${WRF_VERSION}\")" ) + endif() endif() # Find externals now -- this is a little different than normal since we want WRF to From a27750452e685aad497facee1d2701135c777acb Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 31 Jan 2024 18:06:19 -0700 Subject: [PATCH 37/63] Set cpp flags to defaults --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df9b82850..d48b09379 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,7 +111,7 @@ set( WPS_UNDEFINITIONS_LIST ${WPS_DEFINITIONS_LIST} ) list( FILTER WPS_UNDEFINITIONS_LIST EXCLUDE REGEX "^-D(.*)" ) # Add this to the cpp processing -list( APPEND CMAKE_C_PREPROCESSOR_FLAGS ${WPS_UNDEFINITIONS_LIST} ) +list( APPEND CMAKE_C_PREPROCESSOR_FLAGS ${WPS_UNDEFINITIONS_LIST} -P -nostdinc -traditional ) # Filter for anything that is -D list( FILTER WPS_DEFINITIONS_LIST INCLUDE REGEX "^-D(.*)" ) From 246d2986a6047b9e27560aa5eeb35d0b72c7419d Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 31 Jan 2024 18:06:56 -0700 Subject: [PATCH 38/63] Sync with WRF updates for better option outputs --- arch/configure_reader.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/configure_reader.py b/arch/configure_reader.py index 78fa3cabc..fde44dc57 100755 --- a/arch/configure_reader.py +++ b/arch/configure_reader.py @@ -404,7 +404,8 @@ def selectStanza( options ) : # print( stanzaId + stanzaConfig + "[no difference]" ) stanzaIdx += 1 print( "!! - Compiler not found, some configurations will not work and will be hidden" ) - idxSelection = int( input( "Select configuration [0-{stop}] (note !!) : ".format( stop=( stanzaIdx-1) ) ) ) + stringSelection = input( "Select configuration [0-{stop}] Default [0] (note !!) : ".format( stop=( stanzaIdx-1) ) ) + idxSelection = int( stringSelection if stringSelection.isdigit() else 0 ) if idxSelection < 0 or idxSelection > stanzaIdx - 1 : print( "Invalid configuration selection!" ) exit(1) @@ -428,7 +429,7 @@ def selectStanza( options ) : ## Select enum-like string for string-based cmake options ## ######################################################################################################################## -def getStringOptionSelection( topLevelCmake, searchString ) : +def getStringOptionSelection( topLevelCmake, searchString, destinationOption ) : topLevelCmakeFP = open( topLevelCmake, "r" ) topLevelCmakeLines = topLevelCmakeFP.read() topLevelCmakeFP.close() @@ -446,8 +447,9 @@ def getStringOptionSelection( topLevelCmake, searchString ) : # Weed out empties options = [ option for option in options if option ] - optionsFmt = ", ".join( [ "{idx} : {opt}".format( idx=options.index( opt ), opt=opt ) for opt in options ] ) - selection = int( input( "Select option from {optionsStr} [0-{max}] ({opts}) : ".format( optionsStr=searchString, max=len(options)-1, opts=optionsFmt ) ) ) + optionsFmt = "\n\t" + "\n\t".join( [ "{idx} : {opt}".format( idx=options.index( opt ), opt=opt ) for opt in options ] ) + stringSelection = input( "Select option for {option} from {optionsSource} [0-{max}] {opts} \nDefault [0] : ".format( option=destinationOption, optionsSource=searchString, max=len(options)-1, opts=optionsFmt ) ) + selection = int( stringSelection if stringSelection.isdigit() else 0 ) if selection < 0 or selection > len(options) : print( "Invalid option selection for " + searchString + "!" ) @@ -577,7 +579,7 @@ def projectSpecificOptions( options, stanzaCfg ) : # togglable # we can safely check this since the user would not have been able to select this stanza if it couldn't be disabled if stanzaCfg.dmCompilersAvailable() : - useMPI = input( "[DM] Use MPI? [Y/n] : " ).lower() in yesValues + useMPI = input( "[DM] Use MPI? Default [N] [y/N] : " ).lower() in yesValues else : useMPI = False else: @@ -587,14 +589,14 @@ def projectSpecificOptions( options, stanzaCfg ) : useOpenMP = False if ( stanzaCfg.serialOpt_ or stanzaCfg.dmparOpt_ ) and ( stanzaCfg.smparOpt_ or stanzaCfg.dmsmOpt_ ): # togglable - useOpenMP = input( "[SM] Use OpenMP? [Y/n] : " ).lower() in yesValues + useOpenMP = input( "[SM] Use OpenMP? Default [N] [y/N] : " ).lower() in yesValues else: # User has no choice in the matter useOpenMP = ( stanzaCfg.smparOpt_ or stanzaCfg.dmsmOpt_ ) ############################################################################## - buildExt = input( "[EXT] Build external? [Y/n] : " ).lower() in yesValues + buildExt = input( "[EXT] Build external? Default [N] [y/N] : " ).lower() in yesValues additionalOptions = { # "WRF_CORE" : coreOption, From 0d997cda88627ef03a45550e029257a304e6d577 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 1 Feb 2024 11:07:45 -0700 Subject: [PATCH 39/63] Sync with WRF developments --- arch/configure_reader.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/arch/configure_reader.py b/arch/configure_reader.py index fde44dc57..69f71aa6e 100755 --- a/arch/configure_reader.py +++ b/arch/configure_reader.py @@ -429,7 +429,7 @@ def selectStanza( options ) : ## Select enum-like string for string-based cmake options ## ######################################################################################################################## -def getStringOptionSelection( topLevelCmake, searchString, destinationOption ) : +def getStringOptionSelection( topLevelCmake, searchString, destinationOption, defaultIndex=0 ) : topLevelCmakeFP = open( topLevelCmake, "r" ) topLevelCmakeLines = topLevelCmakeFP.read() topLevelCmakeFP.close() @@ -448,8 +448,15 @@ def getStringOptionSelection( topLevelCmake, searchString, destinationOption ) : options = [ option for option in options if option ] optionsFmt = "\n\t" + "\n\t".join( [ "{idx} : {opt}".format( idx=options.index( opt ), opt=opt ) for opt in options ] ) - stringSelection = input( "Select option for {option} from {optionsSource} [0-{max}] {opts} \nDefault [0] : ".format( option=destinationOption, optionsSource=searchString, max=len(options)-1, opts=optionsFmt ) ) - selection = int( stringSelection if stringSelection.isdigit() else 0 ) + stringSelection = input( "Select option for {option} from {optionsSource} [0-{max}] {opts} \nDefault [{defIdx}] : ".format( + option=destinationOption, + optionsSource=searchString, + max=len(options)-1, + opts=optionsFmt, + defIdx=defaultIndex + ) + ) + selection = int( stringSelection if stringSelection.isdigit() else defaultIndex ) if selection < 0 or selection > len(options) : print( "Invalid option selection for " + searchString + "!" ) @@ -571,6 +578,8 @@ def projectSpecificOptions( options, stanzaCfg ) : # These are yes yesValues = [ "yes", "y", "true", "1" ] + # Acceptable no values + noValues = [ "no", "n", "false", "0" ] ############################################################################## # Decompose the weird way to write the logic for DM/SM @@ -579,7 +588,7 @@ def projectSpecificOptions( options, stanzaCfg ) : # togglable # we can safely check this since the user would not have been able to select this stanza if it couldn't be disabled if stanzaCfg.dmCompilersAvailable() : - useMPI = input( "[DM] Use MPI? Default [N] [y/N] : " ).lower() in yesValues + useMPI = not( input( "[DM] Use MPI? Default [Y] [Y/n] : " ).lower() in noValues ) else : useMPI = False else: From c31fc746666b00cd2b49b6b513612f774c28b48d Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 21 Feb 2024 16:42:20 -0700 Subject: [PATCH 40/63] Move compiled fortran modules to a subdir in install --- geogrid/CMakeLists.txt | 2 +- metgrid/CMakeLists.txt | 2 +- ungrib/CMakeLists.txt | 8 ++++---- ungrib/src/ngl/g2/CMakeLists.txt | 2 +- ungrib/src/ngl/w3/CMakeLists.txt | 2 +- util/CMakeLists.txt | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/geogrid/CMakeLists.txt b/geogrid/CMakeLists.txt index d243adc81..f3bb8ecee 100644 --- a/geogrid/CMakeLists.txt +++ b/geogrid/CMakeLists.txt @@ -6,7 +6,7 @@ set_target_properties( geogrid PROPERTIES # Just dump everything in here - Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/geogrid/ + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/geogrid/ Fortran_FORMAT FREE ) diff --git a/metgrid/CMakeLists.txt b/metgrid/CMakeLists.txt index d90980ea7..9729ea5ea 100644 --- a/metgrid/CMakeLists.txt +++ b/metgrid/CMakeLists.txt @@ -6,7 +6,7 @@ set_target_properties( metgrid PROPERTIES # Just dump everything in here - Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/metgrid/ + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/metgrid/ Fortran_FORMAT FREE ) diff --git a/ungrib/CMakeLists.txt b/ungrib/CMakeLists.txt index e6711e201..698ada2db 100644 --- a/ungrib/CMakeLists.txt +++ b/ungrib/CMakeLists.txt @@ -9,7 +9,7 @@ set_target_properties( pgu PROPERTIES # Just dump everything in here - Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/ungrib/ Fortran_FORMAT FREE ) @@ -17,7 +17,7 @@ set_target_properties( ungrib PROPERTIES # Just dump everything in here - Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/ungrib/ Fortran_FORMAT FREE ) @@ -25,7 +25,7 @@ set_target_properties( g1print PROPERTIES # Just dump everything in here - Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/ungrib/ Fortran_FORMAT FREE ) @@ -33,7 +33,7 @@ set_target_properties( g2print PROPERTIES # Just dump everything in here - Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/ungrib/ Fortran_FORMAT FREE ) diff --git a/ungrib/src/ngl/g2/CMakeLists.txt b/ungrib/src/ngl/g2/CMakeLists.txt index 3dc642e53..2e5243006 100644 --- a/ungrib/src/ngl/g2/CMakeLists.txt +++ b/ungrib/src/ngl/g2/CMakeLists.txt @@ -5,7 +5,7 @@ add_library( ${FOLDER_COMPILE_TARGET} STATIC ) set_target_properties( ${FOLDER_COMPILE_TARGET} PROPERTIES - Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${FOLDER_COMPILE_TARGET} + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/${FOLDER_COMPILE_TARGET} # Fortran_FORMAT FREE ) diff --git a/ungrib/src/ngl/w3/CMakeLists.txt b/ungrib/src/ngl/w3/CMakeLists.txt index f5c8b18fd..f3592f021 100644 --- a/ungrib/src/ngl/w3/CMakeLists.txt +++ b/ungrib/src/ngl/w3/CMakeLists.txt @@ -5,7 +5,7 @@ add_library( ${FOLDER_COMPILE_TARGET} STATIC ) set_target_properties( ${FOLDER_COMPILE_TARGET} PROPERTIES - Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${FOLDER_COMPILE_TARGET} + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/${FOLDER_COMPILE_TARGET} # Fortran_FORMAT FREE ) target_sources( diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 54b67ef8e..684ecae31 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -66,7 +66,7 @@ foreach( TARGET ${ALL_UTIL_TARGETS} util_common ) ${TARGET} PROPERTIES # Just dump everything in here - Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/util/ + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/util/ Fortran_FORMAT FREE ) From 72a202501ce50ef3f62b3fe250689ded926f9674 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 21 Feb 2024 16:43:02 -0700 Subject: [PATCH 41/63] Better usage of build externals with updates to find jasper and note zlib --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d48b09379..d4d28e94a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,7 @@ endif() # First do externals -if ( BUILD_EXTERNALS ) +if ( ${BUILD_EXTERNALS} ) add_subdirectory( external ) # If we got here everything built, we are safe to add find paths for libs set( ZLIB_ROOT ${INTERNAL_GRIB2_PATH} ) # This may get overridden by HDF5 if zlib is packaged with that @@ -99,7 +99,15 @@ endif() # rather than finding our external thirdparty libraries first find_package( ZLIB REQUIRED ) find_package( PNG REQUIRED ) -find_package( Jasper 1.900.1...<1.900.24 REQUIRED ) +find_package( Jasper 1.900.1...1.900.29 REQUIRED ) + +# Because WRF might use a different version of zlib, check to see if we are using a different one +# when externals (really internals) are used +if ( ${BUILD_EXTERNALS} AND ${WRF_FOUND} ) + if ( NOT ( ${ZLIB_INCLUDE_DIRS} STREQUAL ${INTERNAL_GRIB2_PATH}/include ) ) + message( STATUS "Note: Using WRF-specified zlib instead of ${INTERNAL_GRIB2_PATH}" ) + endif() +endif() # Add config definitions message( STATUS "Adding configuration specific definitions : ${WPS_DEFINITIONS}" ) From 59678855f6f207f634fcbaa82c05392f0935b425 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 21 Feb 2024 16:43:41 -0700 Subject: [PATCH 42/63] Install main bins with .exe links similar to WRF cmake --- CMakeLists.txt | 19 ++++++ cmake/wrf_case_setup.cmake | 124 +++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 cmake/wrf_case_setup.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d4d28e94a..bd6ce9b84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,8 @@ include( CMakePackageConfigHelpers ) # include( confcheck ) # include( gitinfo ) include( wrf_get_version ) +include( wrf_case_setup ) + # Grab version info wrf_get_version( ${PROJECT_SOURCE_DIR}/README ) @@ -156,6 +158,23 @@ add_subdirectory( util ) ## Install and export ## ################################################################################ +wrf_setup_targets( + TARGETS + $ + $ + $ + DEST_PATH ${CMAKE_INSTALL_PREFIX}/bin + ) + + +wrf_setup_files( + FILES + ${PROJECT_SOURCE_DIR}/link_grib.csh + DEST_PATH + ${CMAKE_INSTALL_PREFIX}/bin + USE_SYMLINKS + ) + # Install to namespace install( diff --git a/cmake/wrf_case_setup.cmake b/cmake/wrf_case_setup.cmake new file mode 100644 index 000000000..4e65dc0a7 --- /dev/null +++ b/cmake/wrf_case_setup.cmake @@ -0,0 +1,124 @@ +# WRF Macro for adding target symlinks/copies to be run after internal install() code +macro( wrf_setup_targets ) + + set( options USE_SYMLINKS ) + set( oneValueArgs DEST_PATH ) + set( multiValueArgs TARGETS ) + + cmake_parse_arguments( + WRF_SETUP + "${options}" "${oneValueArgs}" "${multiValueArgs}" + ${ARGN} + ) + set( WRF_SETUP_CMD copy_if_different ) + if ( ${WRF_SETUP_USE_SYMLINKS} ) + set( WRF_SETUP_CMD create_symlink ) + endif() + + + foreach ( WRF_SETUP_TARGET ${WRF_SETUP_TARGETS} ) + + # Generate install code for each target + # https://stackoverflow.com/a/56528615 + #!TODO Do we *need* the rm for symlinks beforehand? + # get_filename_component( WRF_SETUP_FILE_ONLY $ NAME + + # If we ever wanted to link or copy things other than binaries we could change this + set( WRF_SETUP_INSTALL_LOCATION ${CMAKE_INSTALL_PREFIX}/bin ) + + install( + CODE " + message( STATUS \"Setting up $ via ${WRF_SETUP_CMD}\" ) + execute_process( COMMAND ${CMAKE_COMMAND} -E ${WRF_SETUP_CMD} ${WRF_SETUP_INSTALL_LOCATION}/$ ${WRF_SETUP_DEST_PATH}/$ ) + " + COMPONENT setup + ) + + # Add .exe link as well + install( + CODE " + message( STATUS \"Creating symlink for $.exe\" ) + execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ${WRF_SETUP_DEST_PATH}/$ ${WRF_SETUP_DEST_PATH}/$.exe ) + " + COMPONENT setup + ) + + endforeach() + +endmacro() + +# WRF Macro for adding file symlinks/copies to be run after internal install() code +macro( wrf_setup_files ) + + set( options USE_SYMLINKS ) + set( oneValueArgs DEST_PATH ) + set( multiValueArgs FILES ) + + cmake_parse_arguments( + WRF_SETUP + "${options}" "${oneValueArgs}" "${multiValueArgs}" + ${ARGN} + ) + set( WRF_SETUP_CMD copy_if_different ) + if ( ${WRF_SETUP_USE_SYMLINKS} ) + set( WRF_SETUP_CMD create_symlink ) + endif() + + foreach ( WRF_SETUP_FILE ${WRF_SETUP_FILES} ) + + # Generate install code for each file, this could be done in a simpler manner + # with regular commands but to preserve order of operations it will be done via install( CODE ... ) + # https://stackoverflow.com/a/56528615 + get_filename_component( WRF_SETUP_FULL_FILE ${WRF_SETUP_FILE} ABSOLUTE ) + get_filename_component( WRF_SETUP_FILE_ONLY ${WRF_SETUP_FILE} NAME ) + # Left here for debug purposes, may want to turn this into a trace-level debug msg + # message( "Generating install commands for ${WRF_SETUP_FILE_ONLY} into ${WRF_SETUP_DEST_PATH}" ) + install( + CODE " + message( STATUS \"Setting up ${WRF_SETUP_FILE_ONLY} via ${WRF_SETUP_CMD}\" ) + execute_process( COMMAND ${CMAKE_COMMAND} -E ${WRF_SETUP_CMD} ${WRF_SETUP_FULL_FILE} ${WRF_SETUP_DEST_PATH}/${WRF_SETUP_FILE_ONLY} ) + " + COMPONENT setup + ) + + endforeach() + +endmacro() + +# WRF Macro for adding file symlink to be run after internal install() code +macro( wrf_setup_file_new_name ) + + set( options USE_SYMLINKS ) + set( oneValueArgs FILE NEW_NAME ) + set( multiValueArgs ) + + cmake_parse_arguments( + WRF_SETUP + "${options}" "${oneValueArgs}" "${multiValueArgs}" + ${ARGN} + ) + + set( WRF_SETUP_CMD copy_if_different ) + if ( ${WRF_SETUP_USE_SYMLINKS} ) + set( WRF_SETUP_CMD create_symlink ) + endif() + + # Generate install code for each file, this could be done in a simpler manner + # with regular commands but to preserve order of operations it will be done via install( CODE ... ) + # https://stackoverflow.com/a/56528615 + get_filename_component( WRF_SETUP_FULL_FILE ${WRF_SETUP_FILE} ABSOLUTE ) + get_filename_component( WRF_SETUP_FILE_ONLY ${WRF_SETUP_FILE} NAME ) + get_filename_component( WRF_SETUP_NEW_NAME_FULL_FILE ${WRF_SETUP_NEW_NAME} ABSOLUTE ) + get_filename_component( WRF_SETUP_NEW_NAME_FILE_ONLY ${WRF_SETUP_NEW_NAME} NAME ) + # Left here for debug purposes, may want to turn this into a trace-level debug msg + # message( "Generating install commands for ${WRF_SETUP_FILE_ONLY} to ${WRF_SETUP_NEW_NAME_FILE_ONLY}" ) + install( + CODE " + message( STATUS \"Setting up ${WRF_SETUP_FILE_ONLY} (rename ${WRF_SETUP_NEW_NAME_FILE_ONLY}) via ${WRF_SETUP_CMD}\" ) + execute_process( COMMAND ${CMAKE_COMMAND} -E ${WRF_SETUP_CMD} ${WRF_SETUP_FULL_FILE} ${WRF_SETUP_NEW_NAME_FULL_FILE} ) + " + COMPONENT setup + ) + +endmacro() + From 46162a0c5387c00cd3d117f57b17e6f71914c5fe Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 22 Feb 2024 10:52:52 -0700 Subject: [PATCH 43/63] Add snippet about cmake compilation --- README | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README b/README index 230c2709e..2235038d1 100644 --- a/README +++ b/README @@ -95,6 +95,15 @@ in configure.wps and then compiled using ./compile plotfmt ./compile plotgrids +Building WPS with CMake + +The WPS cmake build follows the same procedure as the WRF +build procedure, using the following: + ./configure_new + ./compile_new + +The prompts will look similar and present the user with +available options specific to their system. Running WPS (for serially compiled code) From 228145e417b428fc53d9de642a9c7bb33253ba8f Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 14 Mar 2024 12:30:45 -0700 Subject: [PATCH 44/63] Syntax fixes for intel oneAPI icx compiler --- ungrib/src/cio.c | 65 +++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/ungrib/src/cio.c b/ungrib/src/cio.c index 30eee8d61..1a545d6a8 100644 --- a/ungrib/src/cio.c +++ b/ungrib/src/cio.c @@ -48,8 +48,6 @@ #endif /* ****************************************************************** */ - -c_open(unit, nunit, name, mode, err, oflag) /* * unit = Fortran unit number * nunit = UNIX file descriptor associated with 'unit' @@ -64,12 +62,15 @@ c_open(unit, nunit, name, mode, err, oflag) = 1 : file name and unit number printed (and errors) = -1 : no print at all (not even errors) */ - int *unit; - int *nunit; - int *mode; - int *err; - int *oflag; - char name[FORT_FILE_LEN]; +int +c_open( + int *unit, + int *nunit, + char name[FORT_FILE_LEN], + int *mode, + int *err, + int *oflag + ) { int fd, i; char fname[FORT_FILE_LEN]; @@ -114,8 +115,6 @@ c_open(unit, nunit, name, mode, err, oflag) } /* ****************************************************************** */ -bn_seek(fd, bread, mode, iprint) - /* Move the read/write file pointer fd : Unix file descriptor. bread : Number of bytes to move the pointer. @@ -128,9 +127,13 @@ bn_seek(fd, bread, mode, iprint) Location 0 [bn_seek(fd,0,-1,0)] puts us just before the first byte, so the next bn_read will get byte 1. */ - - int *fd, *bread, *mode, *iprint; - +int +bn_seek( + int *fd, + int *bread, + int *mode, + int *iprint + ) { off_t i, offset; int how_to_space; @@ -151,8 +154,6 @@ bn_seek(fd, bread, mode, iprint) } /* ****************************************************************** */ - -bn_read(fd, buf, nbuf, bread, ios, idiag) /* * fd = UNIX file descriptor number (NOT a Fortran unit) * buf = area into which to read @@ -163,8 +164,15 @@ bn_read(fd, buf, nbuf, bread, ios, idiag) 2 = Error in reading * idiag : if non-zero, error and EOF messages will be printed */ - - int *fd, *nbuf, buf[], *bread, *ios, *idiag; +int +bn_read( + int *fd, + int buf[], + int *nbuf, + int *bread, + int *ios, + int *idiag + ) { int bytesread; @@ -197,17 +205,21 @@ bn_read(fd, buf, nbuf, bread, ios, idiag) } /* ****************************************************************** */ - -bnwrit_(fd, buf, nbuf, bwritten, err, idiag) - int *fd, *nbuf, buf[], *bwritten, *err, *idiag; - /* * fd = UNIX file descriptor number (NOT a Fortran unit) buf = area from * which to write nbuf = number of bytes to write to fd bwritten = number * actually written err = UNIX error number returned to FORTRAN idiag : if * non-zero, error and EOF messages will be printed */ - +int +bnwrit_( + int *fd, + int buf[], + int *nbuf, + int *bwritten, + int *err, + int *idiag + ) { int byteswritten; @@ -231,8 +243,6 @@ bnwrit_(fd, buf, nbuf, bwritten, err, idiag) } /* ****************************************************************** */ - -c_close(nunit, iprint, err) /* Close a C (UNIX?) file descriptor: nunit : (INPUT) : The C (UNIX?) file descriptor to close. @@ -241,7 +251,12 @@ Close a C (UNIX?) file descriptor: err : (OUTPUT) : Error flag ( err = 0 : Successful close) ( err = 1 : Error on close) */ - int *nunit, *iprint, *err; +int +c_close( + int *nunit, + int *iprint, + int *err + ) { extern int errno; /* I/O error return */ int istat; From 652f1547965be9fb6be0a2764f256acbb5b09a2c Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 14 Mar 2024 13:05:06 -0700 Subject: [PATCH 45/63] Reorder library linking so symbols are properly resolved --- geogrid/CMakeLists.txt | 3 ++- metgrid/CMakeLists.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/geogrid/CMakeLists.txt b/geogrid/CMakeLists.txt index f3bb8ecee..719d94d8c 100644 --- a/geogrid/CMakeLists.txt +++ b/geogrid/CMakeLists.txt @@ -19,10 +19,11 @@ target_link_libraries( $<$:$> $<$:$> ${netCDF_LIBRARIES} - WRF::WRF_Core + WRF::io_int WRF::io_netcdf WRF::io_grib1 WRF::io_grib_share + WRF::WRF_Core ) target_compile_definitions( diff --git a/metgrid/CMakeLists.txt b/metgrid/CMakeLists.txt index 9729ea5ea..73a0141b2 100644 --- a/metgrid/CMakeLists.txt +++ b/metgrid/CMakeLists.txt @@ -19,10 +19,11 @@ target_link_libraries( $<$:$> $<$:$> ${netCDF_LIBRARIES} - WRF::WRF_Core WRF::io_netcdf + WRF::io_int WRF::io_grib1 WRF::io_grib_share + WRF::WRF_Core ) target_compile_definitions( From ba9574dfd31da4d750131aaab55709179e1b210a Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 14 Mar 2024 13:05:30 -0700 Subject: [PATCH 46/63] Set fortran fixed for these targets --- ungrib/src/ngl/g2/CMakeLists.txt | 2 +- ungrib/src/ngl/w3/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ungrib/src/ngl/g2/CMakeLists.txt b/ungrib/src/ngl/g2/CMakeLists.txt index 2e5243006..e825aa4d9 100644 --- a/ungrib/src/ngl/g2/CMakeLists.txt +++ b/ungrib/src/ngl/g2/CMakeLists.txt @@ -6,7 +6,7 @@ set_target_properties( ${FOLDER_COMPILE_TARGET} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/${FOLDER_COMPILE_TARGET} - # Fortran_FORMAT FREE + Fortran_FORMAT FIXED ) target_compile_definitions( diff --git a/ungrib/src/ngl/w3/CMakeLists.txt b/ungrib/src/ngl/w3/CMakeLists.txt index f3592f021..e0ee3f375 100644 --- a/ungrib/src/ngl/w3/CMakeLists.txt +++ b/ungrib/src/ngl/w3/CMakeLists.txt @@ -6,7 +6,7 @@ set_target_properties( ${FOLDER_COMPILE_TARGET} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/${FOLDER_COMPILE_TARGET} - # Fortran_FORMAT FREE + Fortran_FORMAT FIXED ) target_sources( ${FOLDER_COMPILE_TARGET} From f26ae0cf6ef21ee90c1e08a4c59f106377e60538 Mon Sep 17 00:00:00 2001 From: Do Ngoc Khanh <14163153+epn09@users.noreply.github.com> Date: Tue, 7 May 2024 09:58:04 +0900 Subject: [PATCH 47/63] Move to slucm_kvnk subdirectory --- geogrid/GEOGRID.TBL.ARW | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/geogrid/GEOGRID.TBL.ARW b/geogrid/GEOGRID.TBL.ARW index 900c20162..0503365d5 100644 --- a/geogrid/GEOGRID.TBL.ARW +++ b/geogrid/GEOGRID.TBL.ARW @@ -83,10 +83,10 @@ name=LANDUSEF rel_path = usgs_30s:landuse_30s/ rel_path = usgs_lakes:landuse_30s_with_lakes/ rel_path = modis_lakes:modis_landuse_21class_30s/ - rel_path = modis_2010:modis_landuse_20class_15s_2010s/ - rel_path = modis_2010_lake:modis_landuse_20class_15s_2010s_with_lakes/ - rel_path = modis_2050:modis_landuse_20class_15s_2050s/ - rel_path = modis_2050_lake:modis_landuse_20class_15s_2050s_with_lakes/ + rel_path = modis_2010:slucm_kvnk/modis_landuse_20class_15s_2010s/ + rel_path = modis_2010_lake:slucm_kvnk/modis_landuse_20class_15s_2010s_with_lakes/ + rel_path = modis_2050:slucm_kvnk/modis_landuse_20class_15s_2050s/ + rel_path = modis_2050_lake:slucm_kvnk/modis_landuse_20class_15s_2050s_with_lakes/ rel_path = usgs_2m:landuse_2m/ rel_path = usgs_5m:landuse_5m/ rel_path = usgs_10m:landuse_10m/ @@ -170,7 +170,7 @@ name=GREENFRAC z_dim_name=month masked = water fill_missing = 0. - rel_path=cgls_veg:greenfrac_fcover_cgls/ + rel_path=cgls_veg:slucm_kvnk/greenfrac_fcover_cgls/ rel_path=modis_veg_no_search:greenfrac_fpar_modis/ rel_path=modis_fpar:greenfrac_fpar_modis/ rel_path=nesdis_greenfrac:greenfrac/ @@ -188,7 +188,7 @@ name=LAI12M z_dim_name=month masked = water fill_missing = 0. - rel_path=cgls_veg:lai_cgls/ + rel_path=cgls_veg:slucm_kvnk/lai_cgls/ rel_path=modis_veg_no_search:lai_modis_30s/ rel_path=modis_lai:lai_modis_30s/ rel_path= lowres:lai_modis_10m/ @@ -993,8 +993,8 @@ name = MH_URB2D fill_missing = 0. interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_urb:urban_params/2010/H_avg/ - rel_path = y2050_urb:urban_params/2050/H_avg/ + rel_path = y2010_urb:slucm_kvnk/urban_params/2010/H_avg/ + rel_path = y2050_urb:slucm_kvnk/urban_params/2050/H_avg/ =============================== name = ZD_URB2D priority=1 @@ -1003,8 +1003,8 @@ name = ZD_URB2D fill_missing = 0. interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_urb:urban_params/2010/d/ - rel_path = y2050_urb:urban_params/2050/d/ + rel_path = y2010_urb:slucm_kvnk/urban_params/2010/d/ + rel_path = y2050_urb:slucm_kvnk/urban_params/2050/d/ =============================== name = Z0_URB2D priority=1 @@ -1013,8 +1013,8 @@ name = Z0_URB2D fill_missing = 0. interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_urb:urban_params/2010/z_0/ - rel_path = y2050_urb:urban_params/2050/z_0/ + rel_path = y2010_urb:slucm_kvnk/urban_params/2010/z_0/ + rel_path = y2050_urb:slucm_kvnk/urban_params/2050/z_0/ =============================== name = BUILD_AREA_FRACTION priority=1 @@ -1023,8 +1023,8 @@ name = BUILD_AREA_FRACTION fill_missing = 0. interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_urb:urban_params/2010/lambda_p/ - rel_path = y2050_urb:urban_params/2050/lambda_p/ + rel_path = y2010_urb:slucm_kvnk/urban_params/2010/lambda_p/ + rel_path = y2050_urb:slucm_kvnk/urban_params/2050/lambda_p/ =============================== name = LF_URB2D_S priority=1 @@ -1033,8 +1033,8 @@ name = LF_URB2D_S fill_missing = 0. interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_urb:urban_params/2010/lambda_f/ - rel_path = y2050_urb:urban_params/2050/lambda_f/ + rel_path = y2010_urb:slucm_kvnk/urban_params/2010/lambda_f/ + rel_path = y2050_urb:slucm_kvnk/urban_params/2050/lambda_f/ =============================== name = AHE priority=1 @@ -1043,8 +1043,8 @@ name = AHE fill_missing = 0. interp_option = y2010_ahe:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_ahe:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_ahe:AHE_2010s/2_bytes/ - rel_path = y2050_ahe:AHE_2050s/2_bytes/ + rel_path = y2010_ahe:slucm_kvnk/AHE_2010s/2_bytes/ + rel_path = y2050_ahe:slucm_kvnk/AHE_2050s/2_bytes/ z_dim_name = month_hour =============================== name = AHE @@ -1054,7 +1054,7 @@ name = AHE fill_missing = 0. interp_option = y2010_ahe:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_ahe:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_ahe:AHE_2010s/3_bytes/ - rel_path = y2050_ahe:AHE_2050s/3_bytes/ + rel_path = y2010_ahe:slucm_kvnk/AHE_2010s/3_bytes/ + rel_path = y2050_ahe:slucm_kvnk/AHE_2050s/3_bytes/ z_dim_name = month_hour =============================== From c947a58be96872fa567a294374df08f3705aea8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Umur=20Din=C3=A7?= Date: Wed, 8 May 2024 12:22:31 +0300 Subject: [PATCH 48/63] Update Vtable.ECMWF added new soil values and 2m dewpoint temperature --- ungrib/Variable_Tables/Vtable.ECMWF | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ungrib/Variable_Tables/Vtable.ECMWF b/ungrib/Variable_Tables/Vtable.ECMWF index 8b132433f..f621b7486 100644 --- a/ungrib/Variable_Tables/Vtable.ECMWF +++ b/ungrib/Variable_Tables/Vtable.ECMWF @@ -1,6 +1,6 @@ -GRIB1| Level| From | To | metgrid | metgrid | metgrid |GRIB2|GRIB2|GRIB2|GRIB2| -Param| Type |Level1|Level2| Name | Units | Description |Discp|Catgy|Param|Level| ------+------+------+------+----------+---------+-------------------------------------------+-----------------------+ +GRIB1| Level| From | To | metgrid | metgrid | metgrid |GRIB2|GRIB2|GRIB2|GRIB2| +Param| Type |Level1|Level2| Name | Units | Description |Discp|Catgy|Param|Level| +-----+------+------+------+----------+----------+------------------------------------------+-----------------------+ 129 | 100 | * | | GEOPT | m2 s-2 | | 0 | 0 | | 100 | 156 | 100 | * | | HGT | m | Height | 0 | 3 | 5 | 100 | 130 | 100 | * | | TT | K | Temperature | 0 | 0 | 0 | 100 | @@ -10,7 +10,7 @@ Param| Type |Level1|Level2| Name | Units | Description 165 | 1 | 0 | | UU | m s-1 | U At 10 m | 0 | 2 | 2 | 103 | 166 | 1 | 0 | | VV | m s-1 | V At 10 m | 0 | 2 | 3 | 103 | 167 | 1 | 0 | | TT | K | Temperature At 2 m | 0 | 0 | 0 | 103 | - 168 | 1 | 0 | | DEWPT | K | | 0 | 0 | | 103 | + 168 | 1 | 0 | | DEWPT | K | | 0 | 0 | 6 | 103 | | 1 | 0 | | RH | % | Relative Humidity At 2 m | 0 | 0 | | 103 | 172 | 1 | 0 | | LANDSEA | 0/1 Flag | Land/Sea flag | 2 | 0 | 0 | 1 | 129 | 1 | 0 | | SOILGEO | m2 s-2 | | 0 | 0 | | 103 | @@ -23,13 +23,13 @@ Param| Type |Level1|Level2| Name | Units | Description 141 | 1 | 0 | | SNOW_EC | m | | 0 | 3 | | 101 | | 1 | 0 | | SNOW | kg m-2 |Water Equivalent of Accumulated Snow Depth| 0 | 3 | | 101 | 139 | 112 | 0 | 7 | ST000007 | K | T of 0-7 cm ground layer | 2 | 0 | 2 | 106 | - 170 | 112 | 7 | 28 | ST007028 | K | T of 7-28 cm ground layer | 2 | 0 | | 106 | - 183 | 112 | 28 | 100 | ST028100 | K | T of 28-100 cm ground layer | 2 | 0 | | 106 | - 236 | 112 | 100 | 255 | ST100289 | K | T of 100-289 cm ground layer | 2 | 0 | | 106 | - 39 | 112 | 0 | 7 | SM000007 | fraction | Soil moisture of 0-7 cm ground layer | 2 | 0 | | 106 | - 40 | 112 | 7 | 28 | SM007028 | fraction | Soil moisture of 7-28 cm ground layer | 2 | 0 | | 106 | - 41 | 112 | 28 | 100 | SM028100 | fraction | Soil moisture of 28-100 cm ground layer | 2 | 0 | | 106 | - 42 | 112 | 100 | 255 | SM100289 | fraction | Soil moisture of 100-289 cm ground layer | 2 | 0 | | 106 | + 170 | 112 | 7 | 28 | ST007028 | K | T of 7-28 cm ground layer | 192 | 128 | 170 | 106 | + 183 | 112 | 28 | 100 | ST028100 | K | T of 28-100 cm ground layer | 192 | 128 | 183 | 106 | + 236 | 112 | 100 | 255 | ST100289 | K | T of 100-289 cm ground layer | 192 | 128 | 236 | 106 | + 39 | 112 | 0 | 7 | SM000007 | fraction | Soil moisture of 0-7 cm ground layer | 192 | 128 | 39 | 106 | + 40 | 112 | 7 | 28 | SM007028 | fraction | Soil moisture of 7-28 cm ground layer | 192 | 128 | 40 | 106 | + 41 | 112 | 28 | 100 | SM028100 | fraction | Soil moisture of 28-100 cm ground layer | 192 | 128 | 41 | 106 | + 42 | 112 | 100 | 255 | SM100289 | fraction | Soil moisture of 100-289 cm ground layer | 192 | 128 | 42 | 106 | -----+------+------+------+----------+----------+------------------------------------------+-----+-----+-----+-----+ # # Grib codes are from Table 128 From 72dafba605b6839ce137aba200705638f78049b2 Mon Sep 17 00:00:00 2001 From: Do Ngoc Khanh <14163153+epn09@users.noreply.github.com> Date: Thu, 9 May 2024 09:36:54 +0900 Subject: [PATCH 49/63] Rename directory --- geogrid/GEOGRID.TBL.ARW | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/geogrid/GEOGRID.TBL.ARW b/geogrid/GEOGRID.TBL.ARW index 0503365d5..b3f4b83d1 100644 --- a/geogrid/GEOGRID.TBL.ARW +++ b/geogrid/GEOGRID.TBL.ARW @@ -83,10 +83,10 @@ name=LANDUSEF rel_path = usgs_30s:landuse_30s/ rel_path = usgs_lakes:landuse_30s_with_lakes/ rel_path = modis_lakes:modis_landuse_21class_30s/ - rel_path = modis_2010:slucm_kvnk/modis_landuse_20class_15s_2010s/ - rel_path = modis_2010_lake:slucm_kvnk/modis_landuse_20class_15s_2010s_with_lakes/ - rel_path = modis_2050:slucm_kvnk/modis_landuse_20class_15s_2050s/ - rel_path = modis_2050_lake:slucm_kvnk/modis_landuse_20class_15s_2050s_with_lakes/ + rel_path = modis_2010:slucm/modis_landuse_20class_15s_2010s/ + rel_path = modis_2010_lake:slucm/modis_landuse_20class_15s_2010s_with_lakes/ + rel_path = modis_2050:slucm/modis_landuse_20class_15s_2050s/ + rel_path = modis_2050_lake:slucm/modis_landuse_20class_15s_2050s_with_lakes/ rel_path = usgs_2m:landuse_2m/ rel_path = usgs_5m:landuse_5m/ rel_path = usgs_10m:landuse_10m/ @@ -170,7 +170,7 @@ name=GREENFRAC z_dim_name=month masked = water fill_missing = 0. - rel_path=cgls_veg:slucm_kvnk/greenfrac_fcover_cgls/ + rel_path=cgls_veg:slucm/greenfrac_fcover_cgls/ rel_path=modis_veg_no_search:greenfrac_fpar_modis/ rel_path=modis_fpar:greenfrac_fpar_modis/ rel_path=nesdis_greenfrac:greenfrac/ @@ -188,7 +188,7 @@ name=LAI12M z_dim_name=month masked = water fill_missing = 0. - rel_path=cgls_veg:slucm_kvnk/lai_cgls/ + rel_path=cgls_veg:slucm/lai_cgls/ rel_path=modis_veg_no_search:lai_modis_30s/ rel_path=modis_lai:lai_modis_30s/ rel_path= lowres:lai_modis_10m/ @@ -993,8 +993,8 @@ name = MH_URB2D fill_missing = 0. interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_urb:slucm_kvnk/urban_params/2010/H_avg/ - rel_path = y2050_urb:slucm_kvnk/urban_params/2050/H_avg/ + rel_path = y2010_urb:slucm/urban_params/2010/H_avg/ + rel_path = y2050_urb:slucm/urban_params/2050/H_avg/ =============================== name = ZD_URB2D priority=1 @@ -1003,8 +1003,8 @@ name = ZD_URB2D fill_missing = 0. interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_urb:slucm_kvnk/urban_params/2010/d/ - rel_path = y2050_urb:slucm_kvnk/urban_params/2050/d/ + rel_path = y2010_urb:slucm/urban_params/2010/d/ + rel_path = y2050_urb:slucm/urban_params/2050/d/ =============================== name = Z0_URB2D priority=1 @@ -1013,8 +1013,8 @@ name = Z0_URB2D fill_missing = 0. interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_urb:slucm_kvnk/urban_params/2010/z_0/ - rel_path = y2050_urb:slucm_kvnk/urban_params/2050/z_0/ + rel_path = y2010_urb:slucm/urban_params/2010/z_0/ + rel_path = y2050_urb:slucm/urban_params/2050/z_0/ =============================== name = BUILD_AREA_FRACTION priority=1 @@ -1023,8 +1023,8 @@ name = BUILD_AREA_FRACTION fill_missing = 0. interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_urb:slucm_kvnk/urban_params/2010/lambda_p/ - rel_path = y2050_urb:slucm_kvnk/urban_params/2050/lambda_p/ + rel_path = y2010_urb:slucm/urban_params/2010/lambda_p/ + rel_path = y2050_urb:slucm/urban_params/2050/lambda_p/ =============================== name = LF_URB2D_S priority=1 @@ -1033,8 +1033,8 @@ name = LF_URB2D_S fill_missing = 0. interp_option = y2010_urb:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_urb:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_urb:slucm_kvnk/urban_params/2010/lambda_f/ - rel_path = y2050_urb:slucm_kvnk/urban_params/2050/lambda_f/ + rel_path = y2010_urb:slucm/urban_params/2010/lambda_f/ + rel_path = y2050_urb:slucm/urban_params/2050/lambda_f/ =============================== name = AHE priority=1 @@ -1043,8 +1043,8 @@ name = AHE fill_missing = 0. interp_option = y2010_ahe:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_ahe:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_ahe:slucm_kvnk/AHE_2010s/2_bytes/ - rel_path = y2050_ahe:slucm_kvnk/AHE_2050s/2_bytes/ + rel_path = y2010_ahe:slucm/AHE_2010s/2_bytes/ + rel_path = y2050_ahe:slucm/AHE_2050s/2_bytes/ z_dim_name = month_hour =============================== name = AHE @@ -1054,7 +1054,7 @@ name = AHE fill_missing = 0. interp_option = y2010_ahe:average_gcell(4.0)+four_pt+average_4pt interp_option = y2050_ahe:average_gcell(4.0)+four_pt+average_4pt - rel_path = y2010_ahe:slucm_kvnk/AHE_2010s/3_bytes/ - rel_path = y2050_ahe:slucm_kvnk/AHE_2050s/3_bytes/ + rel_path = y2010_ahe:slucm/AHE_2010s/3_bytes/ + rel_path = y2050_ahe:slucm/AHE_2050s/3_bytes/ z_dim_name = month_hour =============================== From e573715f3603f4134985aaf068c78265688a430f Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Thu, 9 May 2024 14:39:28 -0600 Subject: [PATCH 50/63] Update 'compile' script to support version info for 'ifx' compiler The logic in the compile script to print compiler version information now recognizes the Intel oneAPI Fortran compiler, ifx. --- compile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compile b/compile index c40561355..ba92d2019 100755 --- a/compile +++ b/compile @@ -123,6 +123,8 @@ echo "========================================================================== pgf90 --version else if ( "$comp[1]" == "ifort" ) then ifort -V + else if ( "$comp[1]" == "ifx" ) then + ifx -V else echo "Not sure how to figure out the version of this compiler: $comp[1]" endif From af171201c1aefe1bf9579dbb58056b23a80f7451 Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Thu, 9 May 2024 14:40:29 -0600 Subject: [PATCH 51/63] Add configuration stanza for the Intel oneAPI compilers The MPI wrappers in the new stanza are generic MPI wrappers, mpifort and mpicc, rather than those for the Intel MPI library. --- arch/configure.defaults | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/configure.defaults b/arch/configure.defaults index 25382bab0..1b0df83e6 100644 --- a/arch/configure.defaults +++ b/arch/configure.defaults @@ -268,6 +268,30 @@ CPPFLAGS = -D_UNDERSCORE -DBYTESWAP -DLINUX -DIO_NETCDF -DIO_BINARY - ARFLAGS = CC_TOOLS = +######################################################################################################################## +#ARCH Linux x86_64, Intel oneAPI compilers # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 +# +COMPRESSION_LIBS = CONFIGURE_COMP_L +COMPRESSION_INC = CONFIGURE_COMP_I +FDEFS = CONFIGURE_FDEFS +SFC = ifx +SCC = icx +DM_FC = mpifort +DM_CC = mpicc +FC = CONFIGURE_FC +CC = CONFIGURE_CC +LD = $(FC) +FFLAGS = -FR -convert big_endian +F77FLAGS = -FI -convert big_endian +FCSUFFIX = +FNGFLAGS = $(FFLAGS) +LDFLAGS = +CFLAGS = -w +CPP = /lib/cpp -P -traditional +CPPFLAGS = -D_UNDERSCORE -DBYTESWAP -DLINUX -DIO_NETCDF -DIO_BINARY -DIO_GRIB1 -DBIT32 CONFIGURE_MPI +ARFLAGS = +CC_TOOLS = + ######################################################################################################################## #ARCH Linux x86_64, Intel compiler # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 # From 28c7a3fdd436e671a22b5478234a1e60e2e4e477 Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Thu, 9 May 2024 15:51:14 -0600 Subject: [PATCH 52/63] Change "Intel compiler" to "Intel Classic compilers" in configure.defaults Throughout the arch/configure.defaults file, this commit changes occurrences of "Intel compiler" to "Intel Classic compilers" to distinguish the use of the "Classic" fort/icc compilers from the use of ifx/icx in the "Intel oneAPI compilers" stanza. --- arch/configure.defaults | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/configure.defaults b/arch/configure.defaults index 1b0df83e6..c6caa1559 100644 --- a/arch/configure.defaults +++ b/arch/configure.defaults @@ -97,7 +97,7 @@ ARFLAGS = CC_TOOLS = ######################################################################################################################## -#ARCH Linux i486 i586 i686, Intel compiler # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 +#ARCH Linux i486 i586 i686, Intel Classic compilers # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 # COMPRESSION_LIBS = CONFIGURE_COMP_L COMPRESSION_INC = CONFIGURE_COMP_I @@ -293,7 +293,7 @@ ARFLAGS = CC_TOOLS = ######################################################################################################################## -#ARCH Linux x86_64, Intel compiler # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 +#ARCH Linux x86_64, Intel Classic compilers # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 # COMPRESSION_LIBS = CONFIGURE_COMP_L COMPRESSION_INC = CONFIGURE_COMP_I @@ -317,7 +317,7 @@ ARFLAGS = CC_TOOLS = ######################################################################################################################## -#ARCH Linux x86_64, Intel compiler, SGI MPT # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 +#ARCH Linux x86_64, Intel Classic compilers, SGI MPT # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 # COMPRESSION_LIBS = CONFIGURE_COMP_L COMPRESSION_INC = CONFIGURE_COMP_I @@ -341,7 +341,7 @@ ARFLAGS = CC_TOOLS = ######################################################################################################################## -#ARCH Linux x86_64, Intel compiler, IBM POE # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 +#ARCH Linux x86_64, Intel Classic compilers, IBM POE # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 # COMPRESSION_LIBS = CONFIGURE_COMP_L COMPRESSION_INC = CONFIGURE_COMP_I @@ -415,7 +415,7 @@ RANLIB = ranlib CC_TOOLS = ######################################################################################################################## -#ARCH Darwin Intel Intel compiler # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 +#ARCH Darwin Intel Intel Classic compilers # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 # COMPRESSION_LIBS = CONFIGURE_COMP_L COMPRESSION_INC = CONFIGURE_COMP_I @@ -799,7 +799,7 @@ ARFLAGS = CC_TOOLS = ######################################################################################################################## -#ARCH Cray XC CLE/Linux x86_64, Intel compiler # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 +#ARCH Cray XC CLE/Linux x86_64, Intel Classic compilers # serial serial_NO_GRIB2 dmpar dmpar_NO_GRIB2 # COMPRESSION_LIBS = CONFIGURE_COMP_L COMPRESSION_INC = CONFIGURE_COMP_I From add16802a8ef9b655ca11ec083f3b38482375a22 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 9 May 2024 16:08:48 -0700 Subject: [PATCH 53/63] Allow for building just ungrib --- CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd6ce9b84..814efa34a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,7 +105,7 @@ find_package( Jasper 1.900.1...1.900.29 REQUIRED ) # Because WRF might use a different version of zlib, check to see if we are using a different one # when externals (really internals) are used -if ( ${BUILD_EXTERNALS} AND ${WRF_FOUND} ) +if ( ${BUILD_EXTERNALS} AND "${WRF_FOUND}" ) if ( NOT ( ${ZLIB_INCLUDE_DIRS} STREQUAL ${INTERNAL_GRIB2_PATH}/include ) ) message( STATUS "Note: Using WRF-specified zlib instead of ${INTERNAL_GRIB2_PATH}" ) endif() @@ -158,11 +158,20 @@ add_subdirectory( util ) ## Install and export ## ################################################################################ + +if ( "${WRF_FOUND}" ) + + wrf_setup_targets( + TARGETS + geogrid + metgrid + DEST_PATH ${CMAKE_INSTALL_PREFIX}/bin + ) +endif() + wrf_setup_targets( TARGETS - $ - $ - $ + ungrib DEST_PATH ${CMAKE_INSTALL_PREFIX}/bin ) From 70a534f20f4817439874036190b7327fce680cd9 Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Thu, 9 May 2024 17:24:47 -0600 Subject: [PATCH 54/63] Switch from 'mpifort' to 'mpif90' in the Intel oneAPI compilers stanza The 'mpif90' wrapper seems to be more widely available than 'mpifort'. --- arch/configure.defaults | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/configure.defaults b/arch/configure.defaults index c6caa1559..989bb3c38 100644 --- a/arch/configure.defaults +++ b/arch/configure.defaults @@ -276,7 +276,7 @@ COMPRESSION_INC = CONFIGURE_COMP_I FDEFS = CONFIGURE_FDEFS SFC = ifx SCC = icx -DM_FC = mpifort +DM_FC = mpif90 DM_CC = mpicc FC = CONFIGURE_FC CC = CONFIGURE_CC From dfd1c4f40305b30f9cbdc96e117902fdc77725ef Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Fri, 10 May 2024 12:00:50 -0700 Subject: [PATCH 55/63] Switch default to no --- arch/configure_reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/configure_reader.py b/arch/configure_reader.py index 69f71aa6e..105485dd3 100755 --- a/arch/configure_reader.py +++ b/arch/configure_reader.py @@ -588,7 +588,7 @@ def projectSpecificOptions( options, stanzaCfg ) : # togglable # we can safely check this since the user would not have been able to select this stanza if it couldn't be disabled if stanzaCfg.dmCompilersAvailable() : - useMPI = not( input( "[DM] Use MPI? Default [Y] [Y/n] : " ).lower() in noValues ) + useMPI = not( input( "[DM] Use MPI? Default [N] [y/N] : " ).lower() in yesValues ) else : useMPI = False else: From 5f8091f51a24e9b5a74dcbedf926d0f42a636bc2 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Fri, 10 May 2024 13:46:58 -0700 Subject: [PATCH 56/63] Update WRF find logic --- CMakeLists.txt | 16 ++++++++++++---- arch/configure_reader.py | 12 +++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 814efa34a..036c492e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,10 +9,12 @@ project( WPS ) set( EXPORT_NAME ${PROJECT_NAME} ) set( INTERNAL_GRIB2_PATH ${CMAKE_INSTALL_PREFIX}/grib2 ) -if ( NOT DEFINED WRF_DIR AND NOT DEFINED WRF_ROOT ) - message( STATUS "No WRF_DIR or WRF_ROOT provided, skipping targets that rely on WRF" ) +if ( DEFINED CMAKE_TOOLCHAIN_FILE ) + set( WPS_CONFIG ${CMAKE_TOOLCHAIN_FILE} ) endif() + + list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/ ${PROJECT_SOURCE_DIR}/cmake/modules @@ -41,6 +43,9 @@ include( wrf_case_setup ) # Grab version info wrf_get_version( ${PROJECT_SOURCE_DIR}/README ) +# Disable WRF-specifics entirely +set( USE_WRF ON CACHE BOOL "USE_WRF" ) + ################################################################################ ## ## MPI & OpenMP @@ -89,11 +94,14 @@ endif() # Now find required libraries, which may have been affected by externals -if ( DEFINED WRF_DIR OR DEFINED WRF_ROOT ) - find_package( WRF COMPONENTS WRF_Core io_netcdf io_grib1 io_int REQUIRED ) +if ( DEFINED WRF_DIR OR DEFINED WRF_ROOT OR DEFINED ENV{WRF_DIR} OR DEFINED ENV{WRF_ROOT} ) + # PATHS will be checked last + find_package( WRF COMPONENTS WRF_Core io_netcdf io_grib1 io_int REQUIRED PATHS ../WRF/install ../wrf/install ) if ( ${WRF_FOUND} ) message( STATUS "Found WRF : ${WRF_CONFIG} (found version \"${WRF_VERSION}\")" ) endif() +elseif ( ${USE_WRF} ) + message( STATUS "No WRF_DIR or WRF_ROOT provided, skipping targets that rely on WRF" ) endif() # Find externals now -- this is a little different than normal since we want WRF to diff --git a/arch/configure_reader.py b/arch/configure_reader.py index 105485dd3..ca9c40f8b 100755 --- a/arch/configure_reader.py +++ b/arch/configure_reader.py @@ -606,6 +606,15 @@ def projectSpecificOptions( options, stanzaCfg ) : ############################################################################## buildExt = input( "[EXT] Build external? Default [N] [y/N] : " ).lower() in yesValues + useWRF = not( input( inspect.cleandoc( + """ + [WRF] Try to find WRF for metgrid/geogrid? + Requires WRF path set or ../WRF or ../wrf to exist. + Valid input paths are WRF_ROOT or WRF_DIR, set via env var or passed into cmake. + !!! If no valid path is found, these targets will be skipped !!! + Default [Y] [Y/n] : + """ + ) ).lower() in noValues ) additionalOptions = { # "WRF_CORE" : coreOption, @@ -613,7 +622,8 @@ def projectSpecificOptions( options, stanzaCfg ) : # "WRF_CASE" : caseOption, "USE_OPENMP" : "ON" if useOpenMP else "OFF", "USE_MPI" : "ON" if useMPI else "OFF", - "BUILD_EXTERNALS" : "ON" if buildExt else "OFF" + "BUILD_EXTERNALS" : "ON" if buildExt else "OFF", + "USE_WRF" : "ON" if useWRF else "OFF" } return additionalOptions From 872f1feb77ac47f9f1a9ace9eb254781741a5226 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Fri, 10 May 2024 13:56:17 -0700 Subject: [PATCH 57/63] Use abs paths --- CMakeLists.txt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 036c492e7..cf7578de4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,9 +94,22 @@ endif() # Now find required libraries, which may have been affected by externals -if ( DEFINED WRF_DIR OR DEFINED WRF_ROOT OR DEFINED ENV{WRF_DIR} OR DEFINED ENV{WRF_ROOT} ) +if ( + DEFINED WRF_DIR OR + DEFINED WRF_ROOT OR + DEFINED ENV{WRF_DIR} OR + DEFINED ENV{WRF_ROOT} OR + EXISTS "${PROJECT_SOURCE_DIR}/../WRF/" OR EXISTS "${PROJECT_SOURCE_DIR}/../wrf/" ) # PATHS will be checked last - find_package( WRF COMPONENTS WRF_Core io_netcdf io_grib1 io_int REQUIRED PATHS ../WRF/install ../wrf/install ) + find_package( + WRF + COMPONENTS + WRF_Core io_netcdf io_grib1 io_int + REQUIRED + PATHS + ${PROJECT_SOURCE_DIR}/../WRF/install + ${PROJECT_SOURCE_DIR}/../wrf/install + ) if ( ${WRF_FOUND} ) message( STATUS "Found WRF : ${WRF_CONFIG} (found version \"${WRF_VERSION}\")" ) endif() From 607a666c406c867ffb8d6a45c6953598a3eb0286 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Mon, 13 May 2024 16:33:45 -0700 Subject: [PATCH 58/63] Be more explicit with external source code to be compiled --- arch/configure_reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/configure_reader.py b/arch/configure_reader.py index ca9c40f8b..a1687922b 100755 --- a/arch/configure_reader.py +++ b/arch/configure_reader.py @@ -605,7 +605,7 @@ def projectSpecificOptions( options, stanzaCfg ) : ############################################################################## - buildExt = input( "[EXT] Build external? Default [N] [y/N] : " ).lower() in yesValues + buildExt = input( "[GRIB2] Build GRIB2 libraries (zlib, libpng, JasPer) from source in external/? Default [N] [y/N] : " ).lower() in yesValues useWRF = not( input( inspect.cleandoc( """ [WRF] Try to find WRF for metgrid/geogrid? From d1979bc39452d35c89db9615bfe7b191ab1a4549 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Tue, 14 May 2024 14:36:46 -0700 Subject: [PATCH 59/63] Give detailed error info when WRF not found, and fail if it was requested --- CMakeLists.txt | 76 ++++++++++++++++++++++------------------ arch/configure_reader.py | 14 ++------ 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf7578de4..6f4736795 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,48 @@ set( USE_WRF ON CACHE BOOL "USE_WRF" ) ## MPI & OpenMP ## ################################################################################ + +# First do externals +if ( ${BUILD_EXTERNALS} ) + add_subdirectory( external ) + # If we got here everything built, we are safe to add find paths for libs + set( ZLIB_ROOT ${INTERNAL_GRIB2_PATH} ) # This may get overridden by HDF5 if zlib is packaged with that + set( PNG_ROOT ${INTERNAL_GRIB2_PATH} ) + set( Jasper_ROOT ${INTERNAL_GRIB2_PATH} ) +endif() + + +# Now find required libraries, which may have been affected by externals +if ( ${USE_WRF} ) + # PATHS will be checked last + find_package( + WRF + COMPONENTS + WRF_Core io_netcdf io_grib1 io_int + # REQUIRED # this is technically required but we'll print our own msg + PATHS + ${PROJECT_SOURCE_DIR}/../WRF/install + ${PROJECT_SOURCE_DIR}/../wrf/install + QUIET + NO_CMAKE_ENVIRONMENT_PATH # Do not use _DIR option + ) + if ( ${WRF_FOUND} ) + message( STATUS "Found WRF : ${WRF_CONFIG} (found version \"${WRF_VERSION}\")" ) + else() + message( + FATAL_ERROR + "Compiled WRF model not found. Please ensure a compiled WRF exists " + "and can be found by trying one of the following : \n" + "(1) provide -DWRF_ROOT= to CMake, if done " + "via the configure_new script use -- before option or see ./configure_new -h for more info\n" + "(2) set the environment variable WRF_ROOT to the path to the install location\n" + "(3) compile the WRF model code in ../WRF using the default install location\n" + "\nMore detail on search modes of CMake can be found at\n" + "https://cmake.org/cmake/help/latest/command/find_package.html#search-modes" + ) + endif() +endif() + if ( ${USE_MPI} ) # Through ***MUCH*** debugging, if utilizing MPI__COMPILER # https://cmake.org/cmake/help/latest/module/FindMPI.html#variables-for-locating-mpi @@ -83,40 +125,6 @@ if ( ${USE_OPENMP} ) endif() -# First do externals -if ( ${BUILD_EXTERNALS} ) - add_subdirectory( external ) - # If we got here everything built, we are safe to add find paths for libs - set( ZLIB_ROOT ${INTERNAL_GRIB2_PATH} ) # This may get overridden by HDF5 if zlib is packaged with that - set( PNG_ROOT ${INTERNAL_GRIB2_PATH} ) - set( Jasper_ROOT ${INTERNAL_GRIB2_PATH} ) -endif() - - -# Now find required libraries, which may have been affected by externals -if ( - DEFINED WRF_DIR OR - DEFINED WRF_ROOT OR - DEFINED ENV{WRF_DIR} OR - DEFINED ENV{WRF_ROOT} OR - EXISTS "${PROJECT_SOURCE_DIR}/../WRF/" OR EXISTS "${PROJECT_SOURCE_DIR}/../wrf/" ) - # PATHS will be checked last - find_package( - WRF - COMPONENTS - WRF_Core io_netcdf io_grib1 io_int - REQUIRED - PATHS - ${PROJECT_SOURCE_DIR}/../WRF/install - ${PROJECT_SOURCE_DIR}/../wrf/install - ) - if ( ${WRF_FOUND} ) - message( STATUS "Found WRF : ${WRF_CONFIG} (found version \"${WRF_VERSION}\")" ) - endif() -elseif ( ${USE_WRF} ) - message( STATUS "No WRF_DIR or WRF_ROOT provided, skipping targets that rely on WRF" ) -endif() - # Find externals now -- this is a little different than normal since we want WRF to # take precedence if it is present on which libraries to use to avoid library splicing # rather than finding our external thirdparty libraries first diff --git a/arch/configure_reader.py b/arch/configure_reader.py index a1687922b..3a41c86e9 100755 --- a/arch/configure_reader.py +++ b/arch/configure_reader.py @@ -588,7 +588,7 @@ def projectSpecificOptions( options, stanzaCfg ) : # togglable # we can safely check this since the user would not have been able to select this stanza if it couldn't be disabled if stanzaCfg.dmCompilersAvailable() : - useMPI = not( input( "[DM] Use MPI? Default [N] [y/N] : " ).lower() in yesValues ) + useMPI = not( input( "[DM] Use MPI? Default [N] [y/N] : " ).lower() in yesValues ) else : useMPI = False else: @@ -598,7 +598,7 @@ def projectSpecificOptions( options, stanzaCfg ) : useOpenMP = False if ( stanzaCfg.serialOpt_ or stanzaCfg.dmparOpt_ ) and ( stanzaCfg.smparOpt_ or stanzaCfg.dmsmOpt_ ): # togglable - useOpenMP = input( "[SM] Use OpenMP? Default [N] [y/N] : " ).lower() in yesValues + useOpenMP = input( "[SM] Use OpenMP? Default [N] [y/N] : " ).lower() in yesValues else: # User has no choice in the matter useOpenMP = ( stanzaCfg.smparOpt_ or stanzaCfg.dmsmOpt_ ) @@ -606,15 +606,7 @@ def projectSpecificOptions( options, stanzaCfg ) : ############################################################################## buildExt = input( "[GRIB2] Build GRIB2 libraries (zlib, libpng, JasPer) from source in external/? Default [N] [y/N] : " ).lower() in yesValues - useWRF = not( input( inspect.cleandoc( - """ - [WRF] Try to find WRF for metgrid/geogrid? - Requires WRF path set or ../WRF or ../wrf to exist. - Valid input paths are WRF_ROOT or WRF_DIR, set via env var or passed into cmake. - !!! If no valid path is found, these targets will be skipped !!! - Default [Y] [Y/n] : - """ - ) ).lower() in noValues ) + useWRF = not( input( "[WRF] Attempt to find compiled WRF model (needed for geogrid and metgrid)? Default [Y] [Y/n] : " ).lower() in noValues ) additionalOptions = { # "WRF_CORE" : coreOption, From 3c505ca0de62e686d0e6bcb74f579134b983d79e Mon Sep 17 00:00:00 2001 From: Jim Bresch Date: Mon, 20 May 2024 13:18:41 -0600 Subject: [PATCH 60/63] Update the README and comments in some of the NCEP Vtables. --- ungrib/Variable_Tables/README | 26 +++++++-------- ungrib/Variable_Tables/Vtable.GFS | 33 ++++++++++++++----- ungrib/Variable_Tables/Vtable.GFSENS | 9 +++-- ungrib/Variable_Tables/Vtable.NAM | 27 +++++++++------ .../Variable_Tables/Vtable.RAP.pressure.ncep | 24 ++++++++++---- 5 files changed, 78 insertions(+), 41 deletions(-) diff --git a/ungrib/Variable_Tables/README b/ungrib/Variable_Tables/README index 2a166834f..feb1e3e63 100644 --- a/ungrib/Variable_Tables/README +++ b/ungrib/Variable_Tables/README @@ -7,49 +7,49 @@ Vtable.AGRMETSOIL Vtable.AGRMETSOIL2 Vtable.AGRWRF -Vtable.ARW WRF-ARW -Vtable.ARWp +Vtable.ARW.UPP +Vtable.ARWp.UPP Vtable.AVN0P5WRF Grib 1 legacy Vtable for 0.5 degree NCEP AVN Vtable.AWIP Grib 1 legacy Vtable for NCEP NGM 'AWIPS' grid -Vtable.CFSR2_web Climate Forecast System Reanalysis 2 +Vtable.CFSR Climate Forecast System Reanalysis Vtable.CFSR_mean Climate Forecast System Reanalysis Monthly mean from NOMADS. -Vtable.CFSR_press_pgbh06 CFSR pressure-level output from NCAR -Vtable.CFSR_sfc_flxf06 CFSR surface fields from NCAR Vtable.ECMWF ECMWF files. Note that there is a wide variety of content in files called 'ECMWF output'. This Vtable is a general table for pressure-level output. Vtable.ECMWF_sigma ECMWF sigma-level output Vtable.ERA-interim.ml ERA interim model level -Vtable.ERA-interim.ml.SSTMSKD Masked SST Vtable.ERA-interim.pl ERA interim pressure level output -Vtable.ERA-interim.pl.SSTMSKD Masked SST Vtable.GFDL Grib 1 legacy Vtable for NOAA GFDL Vtable.GFS NCEP Global Forecast System (can also be used for GDAS, FNL, AVN files) -Vtable.GFS+TROP NCEP GFS including the 10 tropopause / max wind level fields Vtable.GFSENS NCEP GFS ensemble files (GEFS) +Vtable.GFS_OZONE NCEP Global Forecast System plus Ozone Vtable.GODAS NCEP's Global Ocean data assimilation system Vtable.GSM +Vtable.ICONm DWD ICON model level +Vtable.ICONp DWD ICON pressure level Vtable.JMAGSM Japanese Meteorological Agency Global Spectral Model Vtable.NAM NCEP North American Mesoscale model Vtable.NARR NCEP North American Regional Reanalysis +Vtable.NavySST Grib 1 legacy Vtable for SST fields. Vtable.NCEP2 NCEP/DOE Reanalysis (Reanalysis-2) (also called R2, CDAS2, NCEP2) Vtable.NNRP NCEP/NCAR Reanalysis Project (Grib 1) Vtable.NOGAPS U.S. Navy NOGAPS model Vtable.NOGAPS_needs_GFS_soil -Vtable.NavySST Grib 1 legacy Vtable for SST fields. -Vtable.RAP.hybrid.ncep NCEP Rapid Refresh (ARW) intepolated to hybrid levels (presumably for backward compatibility with RUC) +Vtable.raphrrr +Vtable.RAP.hybrid.ncep NCEP Rapid Refresh (ARW) interpolated to hybrid levels (presumably for + backward compatibility with RUC) Vtable.RAP.pressure.ncep NCEP Rapid Refresh (ARW) pressure level output Vtable.RAP.sigma.gsd NCEP Rapid Refresh (ARW) run by NOAA GSD Vtable.RUCb NCEP RUC hybrid-level output Vtable.RUCp NCEP RUC pressure-level output +Vtable.SREF NCEP SREF pressure-level output Vtable.SST Generic Vtable for SST files Vtable.TCRP Twentieth Century Global Reanalysis Version 2 Vtable.UKMO_ENDGame U.K. Met Office model Vtable.UKMO_LANDSEA Vtable.UKMO_no_heights -Vtable.ICONm DWD ICON model level -Vtable.ICONp DWD ICON pressure level -Updated 01 Apr 2023 +Updated 20 May 2024 + diff --git a/ungrib/Variable_Tables/Vtable.GFS b/ungrib/Variable_Tables/Vtable.GFS index 4b237d3e7..7b38485b8 100644 --- a/ungrib/Variable_Tables/Vtable.GFS +++ b/ungrib/Variable_Tables/Vtable.GFS @@ -52,18 +52,17 @@ Param| Type |Level1|Level2| Name | Units | Description # NCEP has used multiple definitions of the soil temperature in their output and the Vtable attempts # to account for these possibilities. (Definition changed 14 Jan 2015). # -# ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.ccyymmddhh/ (note hh at end) +# As of 22 March 2021: +# +# https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.ccyymmdd/hh/atmos/ +# ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.ccyymmdd/hh/atmos/ # # approx. grid hours domain dx notes # file size no. # -# gfs.t12z.pgrb2.0p25 220000 Kb 193 3-h to 240-h global 0.25 deg (26 p-levels plus sfc and trop, 1000 to 10 mb). -# gfs.t12z.pgrb2.0p50 68000 Kb 4 3-h to 240-h global 0.5 deg (26 p-levels plus sfc and trop, 1000 to 10 mb). -# -# Prior to 12z 14 January 2015: -# -# gfs.t12z.pgrb2f00 56000 Kb 4 3-h to 192-h global 0.5 deg (26 p-levels plus sfc and trop, 1000 to 10 mb). -# gfs.t12z.pgrbf00.grib2 18000 Kb 3 3-h to 384-h global 1.0 deg (26 p-levels plus sfc and trop, 1000 to 10 mb). +# gfs.t12z.pgrb2.0p25 510000 Kb 193 1-h to 120-h global 0.25 deg (41 p-levels plus sfc and trop, 1000 to .01 hPa). +# 3-h to 384-h +# gfs.t12z.pgrb2.0p50 150000 Kb 4 3-h to 384-h global 0.5 deg (41 p-levels plus sfc and trop, 1000 to .01 hPa). # # # As of mid-2017 the GFS provides two land mask fields in the pressure-level output. WPS uses LANDN if available @@ -78,7 +77,13 @@ Param| Type |Level1|Level2| Name | Units | Description # # Abbreviated history of GFS changes (all starting at 12 UTC) # -# Sometime 2019 - Update to FV3 (requires WPS V4.0 or later) +# 29 November 2022 - Updated GFS to V16.3.0. Improved snow depth prediction. +# - Assimilate Leo-Geo winds, MetOp-C AVHRR and ASCAT winds. Upgrade CRTM to V2.4.0 +# 22 March 2021 - Upgrade GFS to V16. Update FV3. Add a new gravity wave parameterization, scale-aware +# TKE-EDMF scheme, update RRTMG. Use LETKF, 4D-IAU, new satellite obs. +# 7 November 2019 - Updated to V15.2.0. Assimilate more satellite data. Fix mask issues over water and +# add LANDN field. +# 12 June 2019 - Updated to V15.1.0 with FV3 dynamical core. (requires WPS V4.0 or later) # 19 July 2017 - Change to land mask and other terrestrial variables (requires WPS V3.9.1.1) # - Change missing value, removal of grid 211 (80km conus). Flag value of .468 in soil moisture. # 11 May 2016 - Assimilate AMSU-A radiances, AVHRR winds, CRTMv2.2.1, 4d hybrid das. @@ -92,3 +97,13 @@ Param| Type |Level1|Level2| Name | Units | Description # 25 September 2007 - Implement UPP. # 31 May 2005 - T254L64 to T382L64. Change in soil output to 3 levels. # 29 October 2002 - Change from T170L42 to T254L64. Model top changed from 2 hPA to .2 hPa +# +# Prior to 12z 22 March 2021: +# +# gfs.t12z.pgrb2.0p25 220000 Kb 193 3-h to 240-h global 0.25 deg (26 p-levels plus sfc and trop, 1000 to 10 mb). +# gfs.t12z.pgrb2.0p50 68000 Kb 4 3-h to 240-h global 0.5 deg (26 p-levels plus sfc and trop, 1000 to 10 mb). +# +# Prior to 12z 14 January 2015: +# +# gfs.t12z.pgrb2f00 56000 Kb 4 3-h to 192-h global 0.5 deg (26 p-levels plus sfc and trop, 1000 to 10 mb). +# gfs.t12z.pgrbf00.grib2 18000 Kb 3 3-h to 384-h global 1.0 deg (26 p-levels plus sfc and trop, 1000 to 10 mb). diff --git a/ungrib/Variable_Tables/Vtable.GFSENS b/ungrib/Variable_Tables/Vtable.GFSENS index bc312c5b0..a1284c4a5 100644 --- a/ungrib/Variable_Tables/Vtable.GFSENS +++ b/ungrib/Variable_Tables/Vtable.GFSENS @@ -38,10 +38,13 @@ Param| Type |Level1|Level2| Name | Units | Description # the files also contain some PDT 11 fields. # # ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/gens/prod/gefs.ccyymmdd +# https://nomads.ncep.noaa.gov/pub/data/nccf/com/gens/prod/gefs.ccyymmdd/hh/atmos/ # -# approx. grid hours domain dx notes +# approx. grid hours domain dx notes # file size no. # -# gep01.txxz.pgrb2fhh 15500 Kb 3 0-h to 384-h global 1 deg 20 ensemble members -# gep01 - gep20 +# gep01.txxz.pgrb2fhh 170000 Kb 193 0-h to 384-h global .25 deg 30 ensemble members +# gep01 - gep30 +# +# # NCEP updated the soil temperature fields on 2 December 2015, matching the changes made in January to the operational GFS. diff --git a/ungrib/Variable_Tables/Vtable.NAM b/ungrib/Variable_Tables/Vtable.NAM index 761a1fcb8..76f89026c 100644 --- a/ungrib/Variable_Tables/Vtable.NAM +++ b/ungrib/Variable_Tables/Vtable.NAM @@ -31,20 +31,27 @@ Param| Type |Level1|Level2| Name | Units | Description # # Vtable for NAM pressure-level data from the ncep server. # +# https://nomads.ncep.noaa.gov/pub/data/nccf/com/nam/prod/nam.ccyymmdd/ # ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/nam/prod/nam.ccyymmdd/ # # approx. grid hours domain dx notes # file size no. # # nam.txxz.awip12hh.tm00.grib2 15018 Kb 218 3-h to 84-h conus 12 sfc fields only -# nam.t12z.awphyshh.grb2.tm00 24000 Kb 218 1-h to 36-h conus 12 25-mb (39 levels plus sfc, 1000 to 50 mb) +# nam.txxz.awphyshh.tm00.grib2 54000 Kb 218 1-h to 36-h conus 12 25-mb (39 levels plus sfc, 1000 to 50 mb) # 3-h to 84-h -# nam.t12z.awip32hh.tm00.grib2 25000 Kb 221 3-h to 84-h conus 32 25-mb (39 levels plus sfc, 1000 to 50 mb) -# nam.t12z.awip3dhh.tm00.grib2 5500 Kb 212 3-h to 84-h conus 40 25-mb (39 levels plus sfc, 1000 to 50 mb) -# nam.t12z.awp211hh.tm00.grib2 470 Kb 211 6-h to 84-h conus 80 50-mb (19 levels plus sfc, 1000 to 100 mb) -# nam.t12z.grbgrdhh.tm00.grib2 5400 KB 104 3-h to 84-h n amer 90 25-mb (39 levels plus sfc, 1000 to 50 mb) -# nam.t12z.bgrdsfhh.tm00.grib2 40000 Kb nat 1-h to 36-h n amer 12 native b-grid -# nam.t12z.awipakhh.tm00.grib2 4400 Kb 216 3-h to 84-h alaska 45 -# nam.t12z.awp217hh.tm00.grib2 1470 Kb 217 3-h to 84-h alaska 22.5 -# nam.t12z.awiphihh.tm00.grib2 4800 Kb 243 3-h to 84-h hawaii 0.4 deg -# nam.t12z.afwahihh.grb2.tm00 15000 Kb 182 3-h to 84-h hawaii 0.1 deg 25-mb (39 levels plus sfc, 1000 to 50 mb) +# nam.txxz.awip32hh.tm00.grib2 25000 Kb 221 3-h to 84-h conus 32 25-mb (39 levels plus sfc, 1000 to 50 mb) +# nam.txxz.awip3dhh.tm00.grib2 5500 Kb 212 3-h to 84-h conus 40 25-mb (39 levels plus sfc, 1000 to 50 mb) +# nam.txxz.awp211hh.tm00.grib2 470 Kb 211 6-h to 84-h conus 80 50-mb (19 levels plus sfc, 1000 to 100 mb) +# nam.txxz.grbgrdhh.tm00.grib2 5400 KB 104 3-h to 84-h n amer 90 25-mb (39 levels plus sfc, 1000 to 50 mb) +# nam.txxz.bgrdsfhh.tm00.grib2 40000 Kb nat 1-h to 36-h n amer 12 native b-grid +# nam.txxz.awipakhh.tm00.grib2 4400 Kb 216 3-h to 84-h alaska 45 +# nam.txxz.awp217hh.tm00.grib2 1470 Kb 217 3-h to 84-h alaska 22.5 +# nam.txxz.awiphihh.tm00.grib2 4800 Kb 243 3-h to 84-h hawaii 0.4 deg +# nam.txxz.afwahihh.grb2.tm00 15000 Kb 182 3-h to 84-h hawaii 0.1 deg 25-mb (39 levels plus sfc, 1000 to 50 mb) +# nam.txxz.conusnest.hiresf01.tm00.grib2 +# 900000 Kb 227 1-h to 60-h conus 5 25-mb (42 levels plus sfc, 1000 to 10 mb) +# +# where xx is 00, 06, 12, 18. +# https://www.nco.ncep.noaa.gov/pmb/products/nam/ +# diff --git a/ungrib/Variable_Tables/Vtable.RAP.pressure.ncep b/ungrib/Variable_Tables/Vtable.RAP.pressure.ncep index 8f39fed48..0396915e1 100644 --- a/ungrib/Variable_Tables/Vtable.RAP.pressure.ncep +++ b/ungrib/Variable_Tables/Vtable.RAP.pressure.ncep @@ -22,13 +22,25 @@ Param| Type |Level1|Level2| Name | Units | Description # # Soil fields are in the hybrid-coordinate files. # +# https://nomads.ncep.noaa.gov/pub/data/nccf/com/rap/prod/rap.ccyymmdd/ # ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/rap/prod/rap.ccyymmdd/ # approx. size - -# rap.txxz.awp252pgrbfhh.grib2 20km conus (25-mb, 38-level 1000 to 100 mb plus sfc) 6858 Kb -# rap.txxz.awp130pgrbfhh.grib2 13km conus 12228 Kb -# rap.txxz.awip32fhh.grib2 32km N. Amer. 23188 Kb +# +# rap.txxz.awp252pgrbfhh.grib2 20km conus (25-mb, 38-level 1000 to 100 mb plus sfc) 9400 Kb +# rap.txxz.awp130pgrbfhh.grib2 13km conus 41000 Kb +# rap.txxz.awip32fhh.grib2 32km N. Amer. 19000 Kb # rap.txxz.awp200fhh.grib2 16km Puerto Rico 1600 Kb -# rap.txxz.awp242fhh.grib2 11km Alaska 44757 Kb +# rap.txxz.awp242fhh.grib2 11km Alaska 25000 Kb +# +# hourly output to 21-h, except to 51-h at 03, 09, 15, and 21 UTC cycles. +# +# Abbreviated history of RAP changes (all starting at 12 UTC) +# +# 2 December 2020 - Updated RAP to V5.0. Use WRF-ARW V3.9.1. Updated MYNN, GWD. Raise Ptop to 15 hPa +# - Updated GF scheme. Add smoke transport. Extended forecast length. +# 12 July 2018 - Updated RAP to V4.0. Use WRR-ARW V3.8.1. Extended forecast length. Updated GSI. +# - Hybrid vertical coordinate. Update MYNN and use EDMF. +# 12 July 2017 - Upgrade SST calculations +# 23 August 2016 - Upgrade RAP to V3.0. Expanded domain to include Hawaii. Uses updated GSI. +# - Use WRF-ARW V3.6.1, RRTMG, updated MYNN, GF convective scheme, aerosol-aware Thompson micro. # -# hourly output to 18-h From 7c7ebfec8732a7a04a4a95825340bd8ef35eb501 Mon Sep 17 00:00:00 2001 From: Jim Bresch Date: Wed, 5 Jun 2024 19:10:09 -0600 Subject: [PATCH 61/63] Update g2print to accommodate CMA GFS fields. Add a couple of NCEP GFS fields. The changes only affect the labelling of fields not their decoding. --- ungrib/src/g2print.F | 5 ++++- ungrib/src/ngl/g2/params.f | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ungrib/src/g2print.F b/ungrib/src/g2print.F index 1e233ea1c..3cae1a9dc 100644 --- a/ungrib/src/g2print.F +++ b/ungrib/src/g2print.F @@ -480,6 +480,8 @@ SUBROUTINE r_grib2(junit, gribflnm, hdate, & map%source = 'ECMWF' else if (icenter .eq. 34) then map%source = 'JMA' + else if (icenter .eq. 38) then + map%source = 'CMA' else if (icenter .eq. 74 .or. icenter .eq. 75 ) then map%source = 'UKMO' else @@ -902,7 +904,8 @@ SUBROUTINE r_grib2(junit, gribflnm, hdate, & level=gfld%ipdtmpl(12) * & (10. ** (-1. * gfld%ipdtmpl(11))) else if(gfld%ipdtmpl(10).eq.101 .or.& ! sea level, sfc, or trop - gfld%ipdtmpl(10).eq.1 .or. gfld%ipdtmpl(10).eq.7) then + gfld%ipdtmpl(10).eq.1 .or. gfld%ipdtmpl(10).eq.7 .or. & + gfld%ipdtmpl(10).eq.8 .or. gfld%ipdtmpl(10).eq.10) then level = 0 else if(gfld%ipdtmpl(10).eq.106) then ! below ground sfc is in cm in Vtable level= 100. * gfld%ipdtmpl(12)*(10.**(-1.*gfld%ipdtmpl(11))) diff --git a/ungrib/src/ngl/g2/params.f b/ungrib/src/ngl/g2/params.f index 057c2b4a5..3bd090352 100644 --- a/ungrib/src/ngl/g2/params.f +++ b/ungrib/src/ngl/g2/params.f @@ -40,7 +40,7 @@ module params ! !$$$ - integer,parameter :: MAXPARAM=816 + integer,parameter :: MAXPARAM=832 type gribparam integer :: g1tblver @@ -884,6 +884,24 @@ module params data paramlist(814) /gribparam(2,255,0,6,18,'TCOLWO')/ data paramlist(815) /gribparam(2,255,0,6,19,'TCOLIO')/ data paramlist(816) /gribparam(2,255,0,16,201,'RADARVIL')/ +! Added 06/05/24 for NCEP GFS + data paramlist(817) /gribparam(2,214,0,1,37,'CPRAT')/ + data paramlist(818) /gribparam(2,255,10,2,8,'ICETMP')/ +! Added 06/05/24 for CMA GFS + data paramlist(819) /gribparam(2,255,2,0,24,'HFLUX')/ + data paramlist(820) /gribparam(2,255,0,5,5,'NLWRF')/ + data paramlist(821) /gribparam(2,255,0,4,9,'NSWRF')/ + data paramlist(822) /gribparam(2,255,0,5,8,'DLWRFCS')/ + data paramlist(823) /gribparam(2,255,0,4,11,'NSWRFCS')/ + data paramlist(824) /gribparam(2,255,0,4,53,'USWRFCS')/ + data paramlist(825) /gribparam(2,255,0,1,64,'TCIWV')/ + data paramlist(826) /gribparam(2,255,0,1,69,'TCOLW')/ + data paramlist(827) /gribparam(2,255,0,1,70,'TCOLI')/ + data paramlist(828) /gribparam(2,255,0,6,22,'CDCC')/ + data paramlist(829) /gribparam(2,136,0,2,25,'VWSH')/ + data paramlist(830) /gribparam(2,255,0,1,19,'PTYPE')/ + data paramlist(831) /gribparam(2,255,0,6,11,'CDCB')/ + data paramlist(832) /gribparam(2,255,0,6,12,'CDCTOP')/ contains From 7fa521b8321a486583bc85d1c9eab54e52fccd4d Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Tue, 11 Jun 2024 12:40:55 -0600 Subject: [PATCH 62/63] When extracting FFLAGS in configure script, expand $(FORMAT_FREE) Make variable With commit 48f7904d, Fortran free-format flags were moved from FFLAGS into a separate Make variable named FORMAT_FREE in the arch/configure.defaults file. Because the configure script extracts FFLAGS from the configure.wps file when compiling test programs, the $(FORMAT_FREE) variable is not expanded, leading to compilation errors for test programs. This commit introduces extra logic in the configure script to expand $(FORMAT_FREE) in the FFLAGS string for the specification of the FORMAT_FREE variable in the configure.wps file, allowing for a full set of valid compiler flags to be used when compiling test programs. Note: If FORMAT_FREE itself contains Make variables, these will not be recursively expanded. Also, $(FORMAT_FREE) is the only Make variable that is expanded in FFLAGS at present. --- configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure b/configure index 946cba980..f87ffe59f 100755 --- a/configure +++ b/configure @@ -427,6 +427,8 @@ cat > fort_netcdf.f < /dev/null 2>&1 if [ -f ./gnu_flag_test ]; then ./gnu_flag_test > /dev/null 2>&1 From 006e1bb5b150c909f41b5e9043b924f6ea5bec0d Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Fri, 7 Jun 2024 14:11:50 -0600 Subject: [PATCH 63/63] Update version number to 4.6.0 The version number is set in the top-level README, the compile script, and the geogrid and metgrid global attributes. --- README | 2 +- compile | 2 +- geogrid/src/process_tile_module.F | 2 +- metgrid/src/input_module.F | 4 +++- metgrid/src/process_domain_module.F | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README b/README index b86bdc52f..4b4a8ff7d 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -WRF Pre-Processing System Version 4.5 +WRF Pre-Processing System Version 4.6.0 http://www2.mmm.ucar.edu/wrf/users/ diff --git a/compile b/compile index ba92d2019..dfee3b5da 100755 --- a/compile +++ b/compile @@ -112,7 +112,7 @@ endif # Print out WPS version, system info, and compiler/version echo "============================================================================================== " echo " " - echo Version 4.5 + echo Version 4.6.0 echo " " uname -a echo " " diff --git a/geogrid/src/process_tile_module.F b/geogrid/src/process_tile_module.F index 1fe930380..82257f50b 100644 --- a/geogrid/src/process_tile_module.F +++ b/geogrid/src/process_tile_module.F @@ -301,7 +301,7 @@ subroutine process_tile(which_domain, grid_type, dynopt, & end if ! Initialize the output module now that we have the corner point lats/lons - call output_init(which_domain, 'OUTPUT FROM GEOGRID V4.5', '0000-00-00_00:00:00', grid_type, dynopt, & + call output_init(which_domain, 'OUTPUT FROM GEOGRID V4.6.0', '0000-00-00_00:00:00', grid_type, dynopt, & corner_lats, corner_lons, & start_dom_i, end_dom_i, start_dom_j, end_dom_j, & start_patch_i, end_patch_i, start_patch_j, end_patch_j, & diff --git a/metgrid/src/input_module.F b/metgrid/src/input_module.F index 40abbd2f9..617f8fcf9 100644 --- a/metgrid/src/input_module.F +++ b/metgrid/src/input_module.F @@ -427,7 +427,9 @@ subroutine read_global_attrs(title, start_date, grid_type, dyn_opt, #endif call ext_get_dom_ti_char('TITLE', title) - if (index(title,'GEOGRID V4.5') /= 0) then + if (index(title,'GEOGRID V4.6.0') /= 0) then + wps_version = 4.6 + else if (index(title,'GEOGRID V4.5') /= 0) then wps_version = 4.5 else if (index(title,'GEOGRID V4.4') /= 0) then wps_version = 4.4 diff --git a/metgrid/src/process_domain_module.F b/metgrid/src/process_domain_module.F index 0d6afdd98..18c44dc94 100644 --- a/metgrid/src/process_domain_module.F +++ b/metgrid/src/process_domain_module.F @@ -876,7 +876,7 @@ subroutine process_single_met_time(do_const_processing, & ! now we simply output every field from the storage module. ! - title = 'OUTPUT FROM METGRID V4.5' + title = 'OUTPUT FROM METGRID V4.6.0' ! Initialize the output module for this domain and time call mprintf(.true.,LOGFILE,'Initializing output module.')