ssec / polar2grid

Tools for reading, remapping, and writing satellite instrument data.
http://www.ssec.wisc.edu/software/polar2grid/
GNU General Public License v3.0
71 stars 33 forks source link

Sourcing P2G env variable script no longer adds access to polar2grid.sh in $PATH #678

Closed kathys closed 5 months ago

kathys commented 5 months ago

Liam and I both take advantage of the utility of sourcing the P2G environment setting script $POLAR2GRID_HOME/bin/polar2grid_env.sh to allow us to run polar2grid.sh without having to provide the path to the script. However, with the latest P2G Version 3.1 tarball (polar2grid-swbundle-20240110-204310.tar.gz) this no longer works. It looks like the script no longer adds $POLAR2GRID_HOME/bin/ to your PATH. We would like to continue to have this capability.

djhoese commented 5 months ago

Works for me. As mentioned on slack, there was no intentional change regarding this functionality.

(base) [davidh@bumi tmp]$ tar -xzf /data/dist/polar2grid-swbundle-20240110-204310.tar.gz
(base) [davidh@bumi tmp]$ ll /tmp/polar2grid-swbundle-20240110-204310/bin/polar2grid_env.sh
-rw-r--r-- 1 davidh domain users 3369 Jan 10 21:29 /tmp/polar2grid-swbundle-20240110-204310/bin/polar2grid_env.sh
(base) [davidh@bumi tmp]$ env | grep POLAR2GRID
(base) [davidh@bumi tmp]$ source /tmp/polar2grid-swbundle-20240110-204310/bin/polar2grid_env.sh
Running one-time initialization of environment...
(python_runtime) [davidh@bumi tmp]$ env | grep POLAR2GRID
POLAR2GRID_HOME=/tmp/polar2grid-swbundle-20240110-204310
_POLAR2GRID_ENV_LOADED=SHA2-256(/tmp/polar2grid-swbundle-20240110-204310/libexec/python_runtime/lib/python3.11/site-packages/polar2grid-3.1.0.dist-info/METADATA)= 681b77aaa40971afeae579d1b7b127df0f2e4077c3e00b59c8694b95fb984562
djhoese commented 5 months ago

As mentioned on slack, the real problem comes down to calling polar2grid.sh. For example, polar2grid.sh. I assumed when first reading this issue was that POLAR2GRID_HOME was missing, but obviously you mentioned PATH. I missed that.

If I do the above commands but then also check PATH, I do see the lower-level python_runtime environment's bin directory added, but obviously not the POLAR2GRID_HOME/bin/ directory.

However, the weird thing is that I don't see anything that has changed related to this since the last P2G release. I also don't see anything that suggests this should have ever worked. I'll need to do more debugging, but this is weird.

djhoese commented 5 months ago

Ok I figured it out. In the v3.0 release(s), PATH was getting set to the same thing it is now, but when you typed polar2grid.sh it was finding the one that was place in that python_runtime/bin/. That script was placed there during the polar2grid python package installation. This also means scripts like gtiff2mp4.sh are also not on your PATH.

In #654, I switched to the modern way of defining a python package (with a pyproject.toml build definition). This also meant removing what is now considered bad practice and is deprecated which is copying arbitrary files to the installation environment. This is why those .sh scripts aren't there anymore and aren't available.

I'll see what I can come up with for an elegant fix.