w2w icon indicating copy to clipboard operation
w2w copied to clipboard

Error in wrf.exe when using LCZ maps via w2w

Open kellyssa-loren opened this issue 1 year ago • 5 comments

Describe your issue

I am trying to use w2w to incorporate LCZ information into my simulations with WRF v4.5. I am using a snippet for my study area from the global map of DEMUZERE et al., 2022. I run the w2w package, and it works. I can generate the geo_em.dx.nc files correctly. The WPS and real.exe execution is also working fine. However, wrf.exe crashes almost immediately with the following error:

-------------- FATAL CALLED --------------- FATAL CALLED FROM FILE: LINE: 2419 Warning: too many input landuse types -------------------------------------------

WPS, real.exe, and wrf.exe are running normally without LCZ.

How can I fix this? Thank you!

namelist.input.txt

w2w --version

w2w 0.5.0

nc-config --all

This netCDF 4.7.4 has been built with the following features:

  --cc            -> icc
  --cflags        -> -I/opt/comp_ifort_2021/netcdf/include -I/opt/comp_ifort_2021/netcdf/include -I/opt/comp_ifort_2021/include
  --libs          -> -L/opt/comp_ifort_2021/netcdf/lib -L/opt/comp_ifort_2021/netcdf/lib -L/opt/comp_ifort_2021/lib -lnetcdf -lm
  --static        -> -lm

  --has-c++       -> no
  --cxx           ->

  --has-c++4      -> no
  --cxx4          ->

  --has-fortran   -> yes
  --fc            -> ifort
  --fflags        -> -I/opt/comp_ifort_2021/netcdf/include -I/opt/comp_ifort_2021/netcdf/include
  --flibs         -> -L/opt/comp_ifort_2021/netcdf/lib -lnetcdff
  --has-f90       ->
  --has-f03       -> yes

  --has-dap       -> no
  --has-dap2      -> no
  --has-dap4      -> no
  --has-nc2       -> yes
  --has-nc4       -> no
  --has-hdf5      -> no
  --has-hdf4      -> no
  --has-logging   -> no
  --has-pnetcdf   -> no
  --has-szlib     -> no
  --has-cdf5      -> yes
  --has-parallel4 -> no
  --has-parallel  -> no

  --prefix        -> /opt/comp_ifort_2021/netcdf
  --includedir    -> /opt/comp_ifort_2021/netcdf/include
  --libdir        -> /opt/comp_ifort_2021/netcdf/lib
  --version       -> netCDF 4.7.4

Installed Packages

affine==2.4.0
archspec @ file:///croot/archspec_1697725767277/work
attrs==23.1.0
boltons @ file:///work/ci_py311/boltons_1677685195580/work
Brotli @ file:///work/ci_py311/brotli-split_1676830125088/work
certifi @ file:///croot/certifi_1690232220950/work/certifi
cffi @ file:///work/ci_py311/cffi_1676822533496/work
cftime==1.6.3
charset-normalizer @ file:///tmp/build/80754af9/charset-normalizer_1630003229654/work
click==8.1.7
click-plugins==1.1.1
cligj==0.7.2
conda @ file:///croot/conda_1699303130622/work
conda-content-trust @ file:///croot/conda-content-trust_1693490622020/work
conda-libmamba-solver @ file:///croot/conda-libmamba-solver_1700150901600/work/src
conda-package-handling @ file:///croot/conda-package-handling_1690999929514/work
conda_package_streaming @ file:///croot/conda-package-streaming_1690987966409/work
cryptography @ file:///croot/cryptography_1694444244250/work
ecmwflibs==0.5.7
findlibs==0.0.5
h5netcdf==1.3.0
h5py==3.10.0
idna @ file:///work/ci_py311/idna_1676822698822/work
jsonpatch @ file:///tmp/build/80754af9/jsonpatch_1615747632069/work
jsonpointer==2.1
libmambapy @ file:///croot/mamba-split_1698782620632/work/libmambapy
netCDF4==1.6.5
numpy==1.26.2
packaging @ file:///croot/packaging_1693575174725/work
pandas==2.1.3
pluggy @ file:///work/ci_py311/pluggy_1676822818071/work
pycosat @ file:///croot/pycosat_1696536503704/work
pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work
pyOpenSSL @ file:///croot/pyopenssl_1690223430423/work
pyparsing==3.1.1
pyproj==3.6.1
PySocks @ file:///work/ci_py311/pysocks_1676822712504/work
python-dateutil==2.8.2
pytz==2023.3.post1
rasterio==1.3.9
requests @ file:///croot/requests_1690400202158/work
rioxarray==0.15.0
ruamel.yaml @ file:///work/ci_py311/ruamel.yaml_1676838772170/work
scipy==1.11.4
six==1.16.0
snuggs==1.4.7
tqdm @ file:///croot/tqdm_1679561862951/work
truststore @ file:///croot/truststore_1695244293384/work
tzdata==2023.3
urllib3 @ file:///croot/urllib3_1698257533958/work
-e git+https://github.com/matthiasdemuzere/w2w.git@adea4f6bd0995bdf4caa0be922f7e3f57d51f5fd#egg=w2w
xarray==2023.11.0
zstandard @ file:///work/ci_py311_2/zstandard_1679339489613/work

Traceback

No response

kellyssa-loren avatar Nov 26 '23 12:11 kellyssa-loren

Mmm ... I am not sure.

@andreazonato could this be related to the fact that W2W uses the 1-40 numbering, whilst the implementation in WRF 4.5 goes from 1-60?

If that is the case, I wonder whether a check should be done in W2W for the WRF version? So that the code adjusts the numbering automatically? Unless of course the new WPS/WRF code will be available soon, so that it no longer makes sense to adjust W2W?

matthiasdemuzere avatar Nov 28 '23 08:11 matthiasdemuzere

Ciao Kelissa,

I think you are using Noah instead of NoahMP, right? In this case, it is an issue with the lakes (LU_INDEX=21), and it is not linked to the urban areas.

Anyway, from version 4.5, LCZ are moved from 3* to 5*, so w2w is not made for it. Or you should add 20 to the LU_INDEX. @matthiasdemuzere, I think the code is gonna be available soon, so no need to modify w2w

Andrea

andreazonato avatar Nov 28 '23 08:11 andreazonato

Hello!

@andreazonato Yes, I was using Noah. I ran a test with NoahMP and found another error:

CRITICAL PROBLEM: HCAN <= ZPD i,j point= 51 35 HCAN = 0.0000000E+00 ZPD = 0.0000000E+00 SNOWH = 0.0000000E+00 -------------- FATAL CALLED --------------- FATAL CALLED FROM FILE: LINE: 3863 CRITICAL PROBLEM IN MODULE_SF_NOAHMPLSM:VEGEFLUX -------------------------------------------

How can I add 20 to the LU_INDEX to try with Noah?

Anyway, to use the LCZ maps effectively with the w2w package, should I try it on another version of WRF (e.g., 4.3)?

kellyssa-loren avatar Dec 01 '23 20:12 kellyssa-loren

@kellyssa-loren

Aplogies for the late reply.

Not sure if this is relevant, but here is a little python code snippet to add 20 to the LU_INDEX for use with most recent WRF versions:

import xarray as xr
import os

ds = xr.open_dataset('./geo_em.d04_LCZ_params.nc')
print(ds['LU_INDEX'].max())
ds['LU_INDEX'] = ds['LU_INDEX'].where(ds['LU_INDEX'] <= 30, ds['LU_INDEX'] + 20)
print(ds['LU_INDEX'].max())
ds.to_netcdf('./geo_em.d04_LCZ_params_UPDATED.nc')

You probably also have to change the number of land catagories, from 41 to 61?

ds.attrs['NUM_LAND_CAT'] = 61

Alternatively you can indeed use the W2W output as is in WRF version 4.3.

matthiasdemuzere avatar Jan 15 '24 08:01 matthiasdemuzere

Hello!

@andreazonato Yes, I was using Noah. I ran a test with NoahMP and found another error:

CRITICAL PROBLEM: HCAN <= ZPD i,j point= 51 35 HCAN = 0.0000000E+00 ZPD = 0.0000000E+00 SNOWH = 0.0000000E+00 -------------- FATAL CALLED --------------- FATAL CALLED FROM FILE: LINE: 3863 CRITICAL PROBLEM IN MODULE_SF_NOAHMPLSM:VEGEFLUX -------------------------------------------

Sorry for the late reply!

I have no idea why this error is taking place. You should ask WRF people directly

Anyway, to use the LCZ maps effectively with the w2w package, should I try it on another version of WRF (e.g., 4.3)?

yes, or you can move with some netcdf software your classes from 3* to 5*

andreazonato avatar Jan 18 '24 13:01 andreazonato