I’m running AM3 with a different STASH list. It works well with the alpha release branch but I’m getting an error when I try to run the model in a different resolution.
The error is associated with the conversion to netcdf:
Exception: Unable to match levels of heaviside function to variable geopotential_height
The file I’m trying to convert to netcdf does not include the geopotential hight, it includes only:
| Variable name |
sec |
item |
code |
type |
freq |
| TEMPERATURE AT 1.5M |
3 |
236 |
m01s03i236 |
max |
daily |
| TEMPERATURE AT 1.5M |
3 |
236 |
m01s03i236 |
min |
daily |
| LARGE SCALE RAIN AMOUNT KG/M2/TS |
4 |
201 |
m01s04i201 |
accum |
daily |
| LARGE SCALE SNOW AMOUNT KG/M2/TS |
4 |
202 |
m01s04i202 |
accum |
daily |
| CONVECTIVE RAIN AMOUNT KG/M2/TS |
5 |
201 |
m01s05i201 |
accum |
daily |
| CONVECTIVE SNOW AMOUNT KG/M2/TS |
5 |
202 |
m01s05i202 |
accum |
daily |
| TOTAL PRECIPITATION AMOUNT KG/M2/TS |
5 |
226 |
m01s05i226 |
accum |
daily |
Looking at the code, I’m not sure why it returning that error.
When running the script from the terminal (outside the suite) it works fine:
python /g/data/access/apps/pythonlib/um2netcdf4/2.1/um2netcdf4.py n640a.pb1983jan test_b.nc
I’m now testing if this problem persist for other output streams, but for now this is the only problematic one.
I appreciate any ideas to try next 
Hi Pao,
When running the script from the terminal (outside the suite) it works fine
Is this on the same model output file, but running inside vs outside the suite? i.e. the model is definitely writing the variables that you think it is, having modified the stash?
Did you run the ‘tidy STASH’ macro in the suite after redefining your output?
My first guess (from looking at the block of code in /g/data/access/apps/pythonlib/um2netcdf4/2.1/um2netcdf4.pythat contains the error message) would be that something isn’t doing what you think it should be, and geopotential_heightis being written to one of the fields that you think is now defined as something else.
I can’t see how running the script as a standalone (on the same output file?) would run successfully if that were the case, though 
Quick idea, add itemcode to the error message output in L226 of /g/data/access/apps/pythonlib/um2netcdf4/2.1/um2netcdf4.pyto check that the STASH codes are doing what you think they should be?
i.e. raise Exception(‘Unable to match levels of heaviside function to variable %s’ % c.name())
==> raise Exception(‘Unable to match levels of heaviside function to variable %s’ % (c.name(), itemcode))
(not sure if that second set of brackets is needed).
I found the problem, of course it was me 
Along with the new output file there where a few old files created with a different stash. The netcdf conversion step in the suite was picking those up along with the correct files.
But when I was running the script from outside the suite, I was using the correct file.
Thanks a lot for the suggestions @bethanwhite! it helped me to understand the problem and I learned a thing or two!
2 Likes
Yay! Great to hear @paocorrales 