Closed arthur-e closed 1 year ago
This turned out to be a stupid mistake on my part, if you pull the latest main
then the SLSTR example should now work!
@simonrp84 I'm making progress! I can run the entire Example_SLSTR.ipynb
notebook now without error. I see that output *.tif
files are written to my output directory. This is what the resulting file cox_munk_refl_S3_20230123_191305.tif
looks like:
All of the outputs seem to have data and georeference information except for:
S1_20230123_191305.tif
S2_20230123_191305.tif
S3_20230123_191305.tif
Each of these is files is too small (ca. 30.8 kb) and has no valid data or georeference information:
rasterio.open('/home/arthur.endsley/Downloads/PyCoxMunk/outputs/S1_20230123_191305.tif')
/usr/local/python-env/PyCoxMunk/lib/python3.8/site-packages/rasterio/__init__.py:304: NotGeoreferencedWarning: Dataset has no geotransform, gcps, or rpcs. The identity matrix will be returned.
dataset = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)
Out[3]: <open DatasetReader name='/home/arthur.endsley/Downloads/PyCoxMunk/outputs/S1_20230123_191305.tif' mode='r'>
If the output reflectance image (above) looks correct, maybe the issue with bands S1, S2, S3 isn't serious(?)
Hi @arthur-e - can you try updating your copy of the repo? The problem with SLSTR should be corrected in the latest commit to the example notebook...
I cloned a fresh upstream repo and installed again; latest commit was 03f5d618
on Mon Feb 6 14:10:41 2023.
I'll try again after installing with conda
in a conda environment.
I'm getting the same result in a clean conda environment, with pycoxmunk==1.0.0
installed using conda-forge
. Perhaps there is something wrong with the SLSTR granule I chose? I re-downloaded the granule but am getting the same result. Is there a reference SLSTR dataset I can use?
I think this is because you're installing the conda-forge
version, which doesn't have the fix pushed to it*. You'll need the current github main
.
Can you try these steps?
conda create --name test_pcm python=3.10
conda activate test_pcm
git clone git@github.com:simonrp84/PyCoxMunk.git
cd PyCoxMunk
pip install -e .
pip install notebook netcdf4 h5netcdf rasterio
Then run the notebook. This works in a fresh environment for me, so hopefully it'll work for you too!
* I don't want to make a new PyCoxMunk
release until we know the fixes are working and any other minor problems are corrected. But once we're happy the problem is resolved I'll do a patch release :)
@simonrp84 With pip
version 20.0.2 and Python 3.8, it seems it's not possible to install a repo in editable mode unless it has a setup.py
file.
conda create --name test_pcm
conda activate test_pcm
pip install -e .
ERROR: File "setup.py" not found. Directory cannot be installed in editable mode: /usr/local/dev/PyCoxMunk
(A "pyproject.toml" file was found, but editable mode currently requires a setup.py based build.)
Independently, I'm having trouble with conda
, where the conda
environment's Python binary is not on my path...
$ conda activate test_pcm
$ which python
/usr/bin/python
Not sure why it is giving me the system-wide Python installation. I get a similar result with which python3
. I don't have this problem with virtualenv
:
$ git clone git@github.com:simonrp84/PyCoxMunk.git
$ cd PyCoxMunk
$ virtualenv /usr/local/python-env/PyCoxMunk/
$ source /usr/local/python-env/PyCoxMunk/bin/activate
$ which python
/usr/local/python-env/PyCoxMunk/bin/python
Anyways, after installing a virtualenv
with pip
I'm getting the same results; everything in the Simple_SLSTR.ipynb
notebook runs smoothly, without error, but the S1, S2, S3 band GeoTIFFs are each only about ~30 kb and seem to contain no valid data. The Cox-Munk reflectance files are each a smooth, horizontal gradient.
cd /usr/local/dev/PyCoxMunk
pip install -e .
pip install notebook netcdf4 h5netcdf rasterio
jupyter notebook
This is with the PyCoxMunk trunk and:
numpy==1.23.5
scipy==1.10.0
pandas==1.5.3
dask==2023.2.0
pyorbital==1.7.3
pyresample==1.26.1
satpy==0.40.0
click==8.1.3
numba==0.56.4
xarray==2023.1.0
I don't want to hold up the JOSS review. I doubt that it matters whether conda
or virtualenv
are used but...who knows? If this Notebook is working for @molinav then it must just be a problem with my setup. Thank goodness, for my own sake, I only do terrestrial remote sensing. :sweat_smile:
EDIT: In general, I try not to mix pip
and conda
, but I understand that there is not another way to install a local package in a conda
environment(?) If you add a setup.py
file, I could use python setup.py install
within the repo. As you already have a setup.cfg
file, the setup.py
could be quite minimal, as in this example. In fact, I guess I can try adding it myself...
Thanks for the info. I'll be away for the next few days but will investigate more towards the end of next week.
Can you confirm that the GOES example works? You should be able to test that with the PyCoxMunk
from conda / pip (without needing editable mode) and just downloading the example notebook itself from github...
@simonrp84 Yes, the GOES-ABI example works great for me. I did not get through Complex_SEVIRI.ipynb
because I didn't have ERA5 re-analysis data handy.
I did figure out how to get Python into my conda
environment. I had avoided the python=
argument because I'm using a different version of Python; I figured conda
would create my environment with the default Python installation (as is the case with virtualenv
) but, in fact, it seems it must be expressly requested:
$ conda create -n PyCoxMunk python=python3.8
$ conda activate PyCoxMunk
$ which python
/usr/local/dev/miniconda3/envs/PyCoxMunk/bin/python
$ which pip
/usr/local/dev/miniconda3/envs/PyCoxMunk/bin/pip
Success with installing again, though I needed to activate Jupyter Notebook differently...
pip install -e .
pip install notebook netcdf4 h5netcdf rasterio
python -m notebook
Yet the result for Example_SLSTR.ipynb
is the same, unfortunately.
I'm happy to move the review forward if you are able to add documentation on the test suite, when you return.
Hi, I've finally come back to look at PyCoxMunk after some time on other projects. Have just tested on a completely fresh virtual machine:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
[ install conda]
conda install mamba
mamba install pycoxmunk jupyter
I then downloaded the Example_SLSTR.ipynb
notebook and a sample SLSTR file from https://dataspace.copernicus.eu/
Then I ran the notebook, and the results were as expected. So unfortunately I cannot reproduce the problem you have experienced here and am not sure what the best approach to resolve it is.
But I am happy that the GOES notebook at least worked successfully!
I can't reproduce either (for info)
@arthur-e Just to follow up on this - can I close this issue?
Sure, no problem.
Making progress! I'm not sure if the difficulties I'm experiencing with the
Simple_SLSTR
notebook stem from my lack of experience withsatpy
... But starting off from the changes made after issue #3, I have:Unfortunately, I'm getting a
KeyError
:I did check: