Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[climate modeling] issue of landuse integration (Geoclimate LCZs) into WRF atmospheric model #806

Open
FloBre33 opened this issue Apr 4, 2023 · 11 comments

Comments

@FloBre33
Copy link

FloBre33 commented Apr 4, 2023

Hi,

Geoclimate works fine but I have an issue when trying to use the outputs (urban indicators, local climate zones) in my atmospheric model (WRF) to simulate the urban climate of Strasbourg (in France).

The integration of Geoclimate urban indicators in WRF is relatively easy. I first do GIS processing to estimate representative values per urban class (e.g. 10,65m average building height for LCZ2), and then put these values in the WRF file containing urban parameters (URBPARM_LCZ.TBL).

There is however an issue with the integration of the Geoclimate local climate zones (LCZs) in WRF. The Strasbourg area is represented in WRF by a grid of about 30kmx30km (1km resolution) and WRF expects a landuse category per gridpoint (e.g. LCZ2 or crop or forest). I first do GIS processing to intersect the WRF grid with the Geoclimate LCZs, and to determine one LCZ per gridpoint. The issue is that when I replace the old landuse in the WRF domain file (geo_em.d04.nc) by the new landuse (intersected Geoclimate LCZs), the netCDF file attributes are also changed, and WRF then refuses to use the new domain to do the climate simulation.

The landuse replacement was done using CDO (Climate Data Operators), but I'm looking at alternatives such as Python, in order to conserve the file attributes during the landuse replacement.

This may have already happened to someone? Or this might be of interest to people who want to simulate urban climates at high resolution with Geoclimate indicators?

@j3r3m1
Copy link
Collaborator

j3r3m1 commented Apr 4, 2023

If you need the LCZ at grid cell, you might also integrate "LCZ_FRACTION" and "LCZ_PRIMARY" to the list of indicators to calculate at grid scale. You will then obtain a fraction of each LCZ for each of the grid cell (that can be 1 km large) and also the mode of the LCZ fraction (LCZ primary). Does this help ? We might add that to the tuto if needed.

@FloBre33
Copy link
Author

FloBre33 commented Apr 6, 2023

I did this in the first step (GIS processing), but the issue is in the second step (modification of landuse in netCDF file).

Just found a solution with Python and NCO.

# Load Geoclimate landuse data and adapt it to right format for NetCDF file.
python
import pandas as pd
import numpy as np
import netCDF4 as nc
data_lu=pd.read_csv('LU_INDEX.csv')
data_uf=pd.read_csv('FRC_URB2D.csv')
arr_lu=np.array(data_lu)
arr_uf=np.array(data_uf)
tp_arr_lu=arr_lu.transpose()
tp_arr_uf=arr_uf.transpose()
rs_tp_arr_lu=np.reshape(tp_arr_lu,(1,33,27))
rs_tp_arr_uf=np.reshape(tp_arr_uf,(1,33,27))
pathname = '/home2020/home/geo/fbreton/wrf-AMBRES/WRFInputs/landuse_strasbourg/new_landuse_geoclimate'
filename = '%s/geo_em.d04_new.nc'%pathname
ncfile=nc.Dataset(filename,'r+')
ncfile.variables['LU_INDEX'][:]=rs_tp_arr_lu
ncfile.variables['FRC_URB2D'][:]=rs_tp_arr_uf
ncfile.close()
exit()

# Remove unwanted parameter for simulation
ncks -C -O -x -v URB_PARAM geo_em.d04_new.nc geo_em.d04_new_v2.nc

The new domain (with Geoclimate landuse) can now be used in the Metgrid pre-processing component of the WRF model.

Actually, this matter might be more relevant to WRF than to Geoclimate.

@j3r3m1
Copy link
Collaborator

j3r3m1 commented Apr 7, 2023

Actually, this matter might be more relevant to WRF than to Geoclimate.

I suppose it is relevant for both since it is a connection between two tools. It would be nice to have a brief tutorial of how to connect GeoClimate to WRF inputs. @ebocher what do you think ? It might be in an "Example of application cases" ?

@ebocher
Copy link
Member

ebocher commented Apr 11, 2023

@FloBre33
thank you for sharing the information
@j3r3m1
excellent idea ! Ready for a full tutorial and to add it as a use cases section in the wiki.

looking at the python code , I think we could also add in the future an option to store wrf indicators in a NetCDF file ?

@j3r3m1
Copy link
Collaborator

j3r3m1 commented Apr 12, 2023

excellent idea ! Ready for a full tutorial and to add it as a use cases section in the wiki.

@FloBre33 would you help setting this tutorial ?

looking at the python code , I think we could also add in the future an option to store wrf indicators in a NetCDF file ?

If the grid produced in geoClimate is the same as it is in WRF, yes but is it the case ? @FloBre33 ?

@FloBre33
Copy link
Author

FloBre33 commented Apr 14, 2023

@FloBre33 would you help setting this tutorial

Sure.

I see two ways of using Geoclimate for climate simulations with atmospheric models (such as WRF).

Many people who use LCZs (local climate zones) in WRF first take the tool WUDAPT (https://www.wudapt.org/) to make a LCZ map (based on satellite data) and then the tool W2W (https://github.com/matthiasdemuzere/w2w) to put these LCZs (through Python) in the WRF grid.
Geoclimate can give better estimations of urban parameters (based on local geographic data) for each LCZ , and can also provide a better urban mapping of LCZs (10m resolution, vs. 100m for WUDAPT).
For my current research project on the Strasbourg region (France), we compared LCZ maps done with WUDAPT and Geoclimate to the official landuse. Wudapt had better results for rural features (forests, crops) and Geoclimate had better results for urban features.

@j3r3m1
Copy link
Collaborator

j3r3m1 commented Apr 28, 2023

OK so you are only using the LCZ for your WRF modelling ? You are not using the UCP parameters directly in WRF ? If I understand well, your steps are then:

  1. Create the LCZ at 10 m resolution using GeoClimate (actually they are calculated at TSU scale and then rasterized at 10 m)
  2. Convert the LCZ data from step 1 to the input data format needed by the W2W tool
  3. Configure your WRF simulation and run it

What is interesting in our case are the first two cases I suppose. Here is the description of these cases in a tutorial for Linux and for Windows. @FloBre33 can you complete the end of these tutorials with the methodology you have adopted ?

Ideally, in the future, it might be better using directly the UCP calculated by the GeoClimate tool. This is the strenght of using vector data: we calculate the WRF needed UCP parameters. Using the GeoClimate LCZ induce a data loss since you calculate UCP, you use them to calculate LCZ and then you derive standard UCP values from LCZ classes. We might think about a future tutorial where we directly include GeoClimate indicators into WRF.

@FloBre33
Copy link
Author

FloBre33 commented May 5, 2023

Almost. The steps look like this:

  1. Yes, actually this was done by students at the lab. They also generated a Wudapt mapping of LCZs. https://lcz-generator.rub.de/
  2. Since Wudapt is better for rural and Geoclimate for urban, I tried to use the best from each. There is a "nourban" file produced by the tool w2w for the WRF grid. https://github.com/matthiasdemuzere/w2w
    I estimated on QGIS the dominant urban Geoclimate LCZ (and general urban fraction) per WRF gridpoint, and inserted them into the nourban grid. For each urban LCZ, I also estimated on GIS the urban parameters (e.g. building height, population density) based on Geoclimate outputs.
  3. Yes, putting the custom urban parameters in the configuration files.

We ran a WRF sensitivity test in summer and winter with 2 configurations: good urban representation (as described above) vs. coarse representation (basic settings). The results showed reduced bias in temperature and wind by comparison to weather measurements, and also a larger difference between urban, periurban and rural weather conditions (for impact studies such as energy consumption or thermal comfort).

There are some manual steps here so I'm not sure I can translate it into code. It's more of an approach or method.

Also, we use BEP-BEM in WRF rather than just UCM.
https://homepages.see.leeds.ac.uk/~lecag/wiser/sample_wiser_files.dir/Physics_Dudhia.ppt.pdf
https://www2.mmm.ucar.edu/wrf/users/docs/user_guide_v4/v4.3/users_guide_chap5.html

a. Urban canopy model (1): 3-category UCM option with surface effects for roofs, walls, and streets. Includes a green roof option.
b. BEP (2). Building Environment Parameterization: Multi-layer urban canopy model that allows for buildings higher than the lowest model levels. Works with Noah and NoahMP LSM, and Boulac, MYJ PBL and YSU options.
c. BEM (3). Building Energy Model. Adds to BEP, building energy budget with heating and cooling systems. Works with same options as BEP.

@magalietecher
Copy link

magalietecher commented May 17, 2023

Hi, Thank you for these explanations. I'm interested by your methodology to integrate LCZ into WRF and would like to reproduce it. I'm pretty novice so could you explain how do you integrate the geoclimate LCZ and parameters and modify the geogrid file generated by W2W?

@j3r3m1
Copy link
Collaborator

j3r3m1 commented May 17, 2023

@FloBre33 if you have further detail to share it would be nice. We can also grant you the access to the GeoClimate repo, thus you will be able to add a detailed tutorial in the wiki. What do you think ?

@FloBre33
Copy link
Author

FloBre33 commented Jun 2, 2023

I'm pretty novice so could you explain how do you integrate the geoclimate LCZ and parameters and modify the geogrid file generated by W2W?

To calculate the geoclimate LCZ and parameters for the WRF grid, see the explanation (2.) from my post above of last month.

For the geogrid file modification, some methods (R, Python, CDO) can corrupt the file for metgrid use in WRF. A method that worked was using R to open both the file containing the new landuse (estimated on GIS) and the original geogrid file (nourban from Wudapt), then adding the urban classes to the landuse (modify the values at given gridpoints), and saving to .csv format, before using Python as in my post above from April 6.

@FloBre33 if you have further detail to share it would be nice. We can also grant you the access to the GeoClimate repo, thus you will be able to add a detailed tutorial in the wiki. What do you think ?

Since the overall approach combines several languages and tools, I would just advise to get familiar with them. The documentations are given below.

Tools:

Languages:

One part that may be difficult is specific to WRF and GIS, it's the estimation of some of the BEP-BEM urban parameters (e.g. population density), where you need to work with public databases on GIS. Local geographers helped me to do it. Let me know if you have issues.

If you are more familiar with Python, you can drop R entirely. Similarly, if you know ArcGIS, it may substitute to QGIS.

FB

@j3r3m1 j3r3m1 closed this as completed Jan 8, 2024
@ebocher ebocher reopened this Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants