metno / emep-ctm

Open Source EMEP/MSC-W model
GNU General Public License v3.0
30 stars 20 forks source link

rv4.36 and WRF wordsplit - error #83

Closed mvieno closed 2 years ago

mvieno commented 3 years ago

Hi, there is an error that stop the EMEP rv4.36 to run with the WRF met. I think this was in other version but the "STOP" signal war replaced by a simple warning.

 Wordsplit:ERROR: Problem at meteo_source:C:wrfout_d01_YYYY-MM-DD_00:00:00
 Wordsplit:Too many words
STOP-ALL ERROR: NetCDF_mod: wordsplit error:: meteo_source:C:wrfout_d01_YYYY-MM-DD_00:00:00

Massimo

mvieno commented 3 years ago

I removed as a test the call at line 315 in the NetCDF_mod:

!!MV      call CheckStop(ierr /= 0, &
!!23/03/2021        "NetCDF_mod: wordsplit error:: "//trim(MetaData(0,n)))

so it runs, and I get the usual warning messages (since rv4.17?) without stopping the model:

 Wordsplit:ERROR: Problem at meteo_source:C:wrfout_d01_YYYY-MM-DD_00:00:00
 Wordsplit:Too many words
 Created sites_2019.nc
 Wordsplit:ERROR: Problem at meteo_source:C:wrfout_d01_YYYY-MM-DD_00:00:00
 Wordsplit:Too many words
gitpeterwind commented 2 years ago

The problem arises when the name or path of the meteo file contains colons ( : ). It is still present in version 4.45

avaldebe commented 2 years ago

One of the site/sonde metadata attributes is meteo_source, which contains the met file name template:

https://github.com/metno/emep-ctm/blob/4aeb1f6d8e5202daada699a4618b8c126a1f79df/Sites_mod.f90#L997

On the top of my head I can think of 3 ways to addressing the issue:

  1. remove the attribute.
  2. replace the : characters by something that should is not likely to be present on a filename, e.g. |, and revert the replace after the the call to wordsplit
  3. add an optional parameter to wordsplit, indicating to only split up to the number of words requested.

@gitpeterwind and @mifads Do you have any preferences?

gitpeterwind commented 2 years ago

It is not an important attribute, so a simple solution would be best.

Maybe the simplest/most efficient is to first have a replacement of the meteoname, replacing all the : into for example, before the additional : are put into the string.

But anything that works is fine here :)

mifads commented 2 years ago

I had a quick look, but without digging into the code I don't see what is being done anyway. Some comments in the code would be useful to explain the purpose and intention of the wordsplit usage.

avaldebe commented 2 years ago

went for a simple solution, where : characters on the met filename template are replaced by | characters.

@mvieno you can see the changes needed on cdc74b9