ukaea/PROCESS

process_netcdf.py - not urgent

Closed this issue · 9 comments

In GitLab by @Hlux on Mar 6, 2015, 09:06

When using evaluate_uncertainties.py or display_uncertainties.py and one of the output_vars is misspelled or not in the MFILE/netcdf file, the code does either stop or does not work properly. This can be quite an issue, for special cases where the actual name in the mfile object is not intuitive. Therefore, it can be very beneficial to have a list of suggestions that actually do exist in the mfile object. If everything from the MFILE would be suggested, this would be extremely long, so maybe everything matching one or two of the variables in the word should be matched. Of course this could be made a lot more sophisticated than this, but I think will not be necessary.

In GitLab by @Hlux on Jul 2, 2015, 09:19

If you are working on the netcdf library anyway and it is not too much hassle, could you also write a short function, that just outputs all the available variables in the netcdf file? This would be very helpful, if you don't know, which variables are available in a given file.

In GitLab by @Edwardsj on Jul 2, 2015, 15:12

I had a look at getting partial matches/suggestions for strings a while ago and it looks like there's a pretty simple way to do it, if I remember correctly. If I get a chance I'll add it in (a suggestion function).

In GitLab by @Edwardsj on Jul 5, 2015, 15:37

New method on MFile instances called suggest_variable. Uses fuzzywuzzy library, which I've installed to the PROCESS user's own site-packages directory (in /home/PROCESS/.local/lib/python3.3/). (This in turn also uses the python-Levenshtein package that is now installed in the same place.)

@pknight to do this I had to update the develop module so that when it's loaded it will be ready to import the library on the PYTHONPATH.

We could consider getting these packages installed site-wide so there's less environment mangling going on.

In GitLab by @Edwardsj on Jul 5, 2015, 15:38

This is in commit 5bc7117c.

In GitLab by @Hlux on Jul 6, 2015, 14:30

mentioned in commit 283db50c5ffe059b4e3107f4bbdb77b9a8c16fe2

In GitLab by @Hlux on Jul 7, 2015, 14:20

put

export PYTHONPATH=$PYTHONPATH:/home/PROCESS/.local/lib/python3.3/site-packages

into .bashrc, until fuzzywuzzy is installed site wide.

In GitLab by @Hlux on Jul 7, 2015, 14:27

From James:
You'll need to do the suggestion outside the get_error method (assuming you're talking about MFileErrorClass.get_error) because the error class doesn't know anything about any other variable in the MFile. It doesn't even know about the existence of the MFile object. Better to call the suggestion function when you encounter an MFileErrorClass instance in whatever context and get the MFileErrorClass.item to pass to the suggestion function.

In GitLab by @jmorris-uk on Jul 17, 2019, 18:04

removed milestone

I've spoken with @timothy-nunn about this and we think this issue is not relevant any more. In looking into this papercut issue, it has been found that a large portion of the cdf code in PROCESS is no longer being used, and an issue has been created to review this and decide if it needs removing from PROCESS: #3072