noaa-oar-arl / monetio

The Model and ObservatioN Evaluation Tool I/O package
https://monetio.readthedocs.io
MIT License
17 stars 30 forks source link

wrf_chem_mm reader loading two different things as height #194

Closed blychs closed 2 months ago

blychs commented 2 months ago

@zmoon @mlirenzhenmayi The _wrfchem_mm.py reader seems to be loading a variable called "height" twice (when var is 'height' and when var is 'zstag'). This causes xr.merge() to fail, at least in my system. I think that the issue is that, in the version I installed (with pip after cloning the main branch on github, so it should be the latest), zstag is also called "height", although it has bottom_top_stag as vertical dimension. Easy solution: adding a rename for zstag:

  101         elif var in {"height", "height_agl", "zstag"}:                                  
  102             var_wrf = getvar(                                                           
  103                 wrflist, var, timeidx=ALL_TIMES, method="cat", squeeze=False, units="m" 
  104             )

to:

  101         elif var in {"height", "height_agl", "zstag"}:                                  
  102             var_wrf = getvar(                                                           
  103                 wrflist, var, timeidx=ALL_TIMES, method="cat", squeeze=False, units="m" 
  104             )                                                                           
  105             if var == "zstag":                                                          
  106                 var_wrf = var_wrf.rename("zstag")  

This should work also with older versions. Cheers Pablo

zmoon commented 2 months ago

Yep I can reproduce that.

blychs commented 2 months ago

Solved in #195