Open kenpryor67 opened 3 years ago
Hi @kenpryor67, the latest version of the master branch (just merged) allows control some of the line colors with additional keywords to the add profile function.
# Add a profile to the Skew-T diagram
mySkewT_Axes2.addProfile(
pressure,
temperature,
dewPointTemperature,
hPa=True,
celsius=True,
method=0,
diagnostics=False,
tdColor="g", # Dry temperature color
tpColor="k", # Parcel temperature color
twColor="b" # Dew point temperature color
)
Let me know if this helps.
Andres, thanks very much for the quick response! Would these line color keywords work with the pip install version? I'm currently using version 1.1.2 (via pip install) and receiving a TypeError: There is no Line2D property "twcolor." Do I need to do a source install? Thanks again, Ken
I haven't released a new version yet.
You can try to install it directly from git with:
pip install -U git+https://github.com/aperezhortal/SkewTplus.git
If that does not work, you can try installing it from the source: https://github.com/aperezhortal/SkewTplus/#install-from-source
Andres, I was able to successfully install SkewTplus from source on my Unix server (@ https://www.pythonanywhere.com/user/KenPryor67/files/home/KenPryor67/skewtplus/SkewTplus-master), however, I'm now receiving a number of import errors upon execution of an IPython notebook from the "SkewTplus-master" directory (e.g. ImportError: No module named _thermodynamics, etc.). I'm sure this is a path issue. Any work around for this? Thanks again very much for all your help!
Hi @kenpryor67, I'm happy to help.
That seems a path issue. _thermodynamics
is a compiled extension that is built during the installation. You can try building the extension in place with python setup.py build_ext --inplace
That will compile the cython sources and place the .so library in the SkewTplus module.
Note that with this, you won't be using the installed version. Instead, you will be using the sources that you have in the SkewTplus-master folder.
Another solution is running the notebook from a different folder than the SkewTplus-master one. In this way, it will use the installed version.
Ok, the "setup.py build_ext --inplace" command worked, and no longer receiving any import errors. However, now I'm receiving a "fatalError: Input Data not supported Details: type(inputData)=<type 'str'>", upon attempting to read the "exampleSounding.txt" file, with the following code:
`# For python2.7 compatibility from future import print_function, division
from SkewTplus.sounding import sounding
mySounding = sounding("./exampleSounding.txt")
mySounding.quickPlot()`
Should the file header be removed? Again, thanks for all your time and guidance with this.
That is an unusual error. That exception shouldn't be raised if the input type is a string. Are you using python2.7 or python 3?
Yes- I am using python2.7. This error occurs even when I add the "#!/usr/bin/env python2.7" statement at the beginning of the script.
My bad, there was a bug in the string-type checking that was only compatible with py3. Commit da16197b8aa2cb36d3f093404f5c18b2784109b3 should fix this issue.
Great! How do I proceed? Do I need to do a complete re-installation of the module?
Yes, you can pull the changes to your local repo, and reinstall the package using pip.
There is no need to do run the build_ext
again to build the .so libraries in place since nothing changed on those extensions.
Andres- sorry to bother you again. I decided to do a complete re-install from source with the latest commit. Unfortunately now I'm receiving yet another odd error:
17:40 ~/skewtplus/SkewTplus-master $ python2.7 setup.py install --prefix=/home/KenPryor67/skewtplus/SkewTplus-master
No local packages or working download links found for matplotlib>=3.1
Traceback (most recent call last):
File "setup.py", line 69, in
I set both PYTHONPATH and PATH to the directory "/home/KenPryor67/skewtplus/SkewTplus-master"
The latest release of Matplotlib for Python 2 is v2.2.5.
I should still be using python2.7 to run setup.py, correct? Thanks again,
Yes, if you want to install the package for python2.7, you should use python2.7 setup.py
to make sure that the extensions are compiled for the right python version.
Recently I merged a PR with updates for matplotlib>=3.1 versions (see #10). This introduced a compatibility problem with python2.7. Hence, the solution to this issue is not straightforward since I can't easily support Matplotlib <=2.2.5 for Python2 and Matplotlib>=3.1 for python3.
If migrating to python3 is not possible for you, the only solution I can think off is branching the repo from the 004f04585ecb776a7c2214d9f2fc9fcc30eef44a commit (python 2 compliant), and apply the changes made by commits 2b70409cabc4635c3eec7517d5008d9afc0f2249 and da16197b8aa2cb36d3f093404f5c18b2784109b3.
Great, thanks. This worked. The python2.7 version is now installed. However, now I'm receiving the following import error:
ImportError Traceback (most recent call last)
You will also need to use contextlib2 instead of contextlib. https://contextlib2.readthedocs.io/en/stable/
You can try install it with pip install contextlib2
and then, replace line from contextlib import ExitStack
for from contextlib2 import ExitStack
in the file skewT.py
Hopefully this will fix the error :crossed_fingers:
Andres- yes. Installed contextlib2. Now I'm receiving an IOError. It appears that sounding.pyc is trying to open exampleSounding.txt as a netCDF file. How can this be changed? We're getting there one step at a time!
IOError Traceback (most recent call last)
The old version of the Netcdf library raised a different type of exception than the expected one: In the sounding.py file (~ line 238), try replacing the OSError exception for IOError:
if fileFormat is None:
# Try automatic detection of file format
try:
self.fetchFromARMFile(inputData)
except OSError: # Here replace OSError for IOError
# If it is not a NETCDF , try TXT
self.fetchFromTxtFile(inputData)
Sorry, that didn't work. Could I just completely comment out the code block for reading NETCDF files? I no plan to read NETCDF files with this module.
Or maybe call the function with fileFormat="txt"
since it is the automatic detection that is causing problems.
Ok! That fixed the IO error. Now encountering an issue with the mySounding.quickPlot() command:
TypeError Traceback (most recent call last)
You need to add from builtins import super
to skewT.py
(and other files if you see a similar exceptions coming from them).
Good morning Andres, the "super" import worked, but now a new type error appears associated with the init function. Again, I really appreciate all your time and help. I hope we're getting closer to the resolution!
TypeError Traceback (most recent call last)
This seems trickier than I expected. I'll try to replicate the error locally to see if I can fix the package for py2.7.
Andres, thanks so much! It's been great working with you on this. I really appreciate your timely responses. I'll look forward to working with a new version of the py2.7 package when it's available. Cheers, Ken
Hi Ken, I've created a branch with the py2.7 version (https://github.com/aperezhortal/SkewTplus/tree/py27) with the latest changes.
You can download the snapshot here and try installing it from the source.
You will need the following dependencies installed: https://github.com/aperezhortal/SkewTplus/blob/py27/requirements_py2.txt
Let me know if this helps.
Thanks very much! I'll download and try the program next week.
How can I change the dew point line plot color to green?