Code Monkey home page Code Monkey logo

cf-view's Issues

map setup returns errors

Version 3.3.0

Start cf-view, choose setup, choose map

With data already read:

Traceback (most recent call last):
  File "/Users/bnl28/Repositories/cf-view/cfview", line 2823, in menu
  self.map_window = Map_window(self.parent)
  File "/Users/bnl28/Repositories/cf-view/cfview", line 4581, in __init__
  self.initUI()
  File "/Users/bnl28/Repositories/cf-view/cfview", line 4667, in initUI
  if len(plotvars.fields) > 0:
  File "/Users/bnl28/Repositories/cf-view/cfview", line 4667, in initUI
  if len(plotvars.fields) > 0
     TypeError:  object of type 'NoneType' has no len()
     File read: ['/Users/bnl28/Data/mars-era-teaching2023.nc']

Before loading data same error without the File read ...

NameError

Seen during a quick test:

$ cfview
Traceback (most recent call last):
  File "/usr/bin/cfview", line 1089, in file_load
    for d in grid:
NameError: global name 'grid' is not defined

This is in version 1.0.4.

Plot box layout usability problems

Watching how Andy approached the plotbox in cfgui, it was obvious that the difference between configured plot and simple plot is confusing. Could we use a toggled button with configuraiton hidden if simple plot is shown? Needs revisiting.

clear code log button

The cf-view window has a log of code and errors on the left. This can get long and include many things not of interest. It would be good to have a clear button (and a save button) for that window.

Climatological Operators

It would be good to add some climate operators to cf-view, so that, e.g. for a file with a year of daily data, it could collapse to monthly means (and several variants of that). Might need a new sub-menu of transform.

Determine and document supported Python versions

Using Python 3.8, I can run cf-view fine, but with 3.12 I get the error of:

$ cfview                                                          ─╯
Traceback (most recent call last):
  File "/home/slb93/miniconda3/envs/cf-env-312/bin/cfview", line 27, in <module>
    from PIL.ImageQt import ImageQt
ImportError: cannot import name 'ImageQt' from 'PIL.ImageQt' (/home/slb93/miniconda3/envs/cf-env-312/lib/python3.12/site-packages/PIL/ImageQt.py). Did you mean: 'Image'?

so there are clearly Python versions, not just older but also newer, for which cf-view doesn't currently work. These are not currently documented as far as I have seen, so we should find out which versions are supported so that cf-view runs, and clearly specify these, including enforcing as a packaging requirement.

File dialog and S3

With the upcoming cf-python update we will have support for S3 in cf-python, and hence in cf-view. But we will need a dialog for working with remote S3 files ... the file dialog is not suitable.

transform fields uses a standard name when it shouldn't

If you create a new field in cf-view using the transform (e.g. the wind speed example that is there now), it creates the new field with a standard name from the old one. It should prompt you for a new name (long or standard).

Populate README with useful information and screenshot previews

As with NCAS-CMS/cf-plot#27 (comment), we should add plenty of information to the README for cf-view. In this case, instead of an example gallery, we should include at least one (ideally more, to demonstrate multiple views) screenshots of the GUI in active use.

For now, I will use the one Andy has included in the homepage of the documentation, but I will go on to try to take other screenshots and add those in.

configuration option for coastline data in cf-view setup

When cartopy first draws a coastline, it looks for coast line data and downloads it. For low resolution data, that's ok, but it can be time consuming for high resolution data.

It might be that there is a central copy of such data in some sites, and it might be that one is using cartopy from within a container, as we do with the cf-view datatools container. In such cases it would be helpful to have a configuration option for cf-view to declare where the data is (or is wanted to be) so as to avoid repeated and/or unnecessary downloads.

At the moment, things seem to end up in the users ./local/share/cartopy directory, but if that's a docker container, then it's clearly not persistent. There is some detail here as to how to do things differently.

Andy's data file seems to break multiple data plots.

import cf
import cfplot as cfp
#
# script generated by cfgui version 0.0.1
#
                    #
dataset=cf.read('/home/bnl/Data/ggap199006200600.nc')
#
fields=[dataset[i] for i in [9]]
sfield=fields[0]
kwargs={}
kwargs['dim2']=cf.wi(-89.1415,89.1415)
kwargs['dim3']=cf.wi(0.0,358.875)
kwargs['dim0']=cf.wi(0.0,0.0)
kwargs['dim1']=cf.wi(1.0,1000.0)
sfield=sfield.subspace(**kwargs)
plotOptions={'mapset': {'proj': 'cyl'}, 'gopen': {'rows': 1, 'columns': 2}, 'nup': 2, 'con': {'colorbar': None, 'blockfill': None, 'fill': True, 'ylog': None, 'negative_linestyle': None, 'xlog': None, 'colorbar_orientation': None, 'lines': True, 'ptype': None, 'line_labels': True}}
cfp.gopen(**plotOptions['gopen'])
plotOptions['con']['title']=sfield.file
cfp.gopen(**plotOptions['gopen'])
cfp.gpos(1)
plotOptions['con']['title']= long_name:p:1000.0 Traceback (most recent call last):
  File "/home/bnl/Code/CF-View/plotConfigWidgets.py", line 166, in _getConfig
    self.callback('Configured',config)
  File "cfgui.py", line 314, in _plot
    cfp.con(sfield.subspace(**slicer),**plotOptions['con'])
  File "/usr/lib/python2.7/site-packages/cf/field.py", line 5790, in __call__
    return field.subspace[field.indices(*arg, **kwargs)]
  File "/usr/lib/python2.7/site-packages/cf/field.py", line 2580, in indices
    repr(identity))
ValueError: Can't find indices: Ambiguous indentity: 'long_name:p'
slicer={'long_name:p': 1000.0}
cfp.con(sfield.subspace(**slicer),**plotOptions['con'])

Generates (when run in the gui):

Traceback (most recent call last):
  File "/home/bnl/Code/CF-View/plotConfigWidgets.py", line 166, in _getConfig
    self.callback('Configured',config)
  File "cfgui.py", line 314, in _plot
    cfp.con(sfield.subspace(**slicer),**plotOptions['con'])
  File "/usr/lib/python2.7/site-packages/cf/field.py", line 5790, in __call__
    return field.subspace[field.indices(*arg, **kwargs)]
  File "/usr/lib/python2.7/site-packages/cf/field.py", line 2580, in indices
    repr(identity))
ValueError: Can't find indices: Ambiguous indentity: 'long_name:p'

Dependency on bounds for block fill. Is it necessary?

This code

import cf
import cfplot as cfp
#
# script generated by cfgui version 0.0.1
#
                    #
dataset=cf.read('../../Data/ggap199006200600.nc')
#
fields=[dataset[i] for i in [9]]
sfield=fields[0]
kwargs={}
kwargs['dim2']=cf.wi(-89.1415,89.1415)
kwargs['dim3']=cf.wi(0.0,358.875)
kwargs['dim0']=cf.wi(0.0,0.0)
kwargs['dim1']=cf.wi(1.0,1000.0)
sfield=sfield.subspace(**kwargs)
plotOptions={'mapset': {'proj': 'cyl'}, 'gopen': {'rows': 1, 'columns': 2}, 'nup': 2,
 'con': {'colorbar': None, 'blockfill': 1, 'fill': None, 'ylog': None, 'negative_line
style': None, 'xlog': None, 'colorbar_orientation': None, 'lines': None, 'ptype': Non
e, 'line_labels': True}}
cfp.gopen(**plotOptions['gopen'])
plotOptions['con']['title']=sfield.file
cfp.gpos(1)
plotOptions['con']['title']=' long_name:p:1000.0 '
slicer={'dim1': 1000.0}
cfp.con(sfield.subspace(**slicer),**plotOptions['con'])

generates the error

python2.7 debug.py 
Traceback (most recent call last):
  File "debug.py", line 24, in <module>
    cfp.con(sfield.subspace(**slicer),**plotOptions['con'])
  File "/usr/lib/python2.7/site-packages/cfplot/cfplot.py", line 312, in con
    if f[0].coord('lon').isbounded:
AttributeError: 'DimensionCoordinate' object has no attribute 'isbounded'

Training video content is missing, leading to broken docs links

The videos.html page of the documentation lists training videos with links to view them, but the video content is not there because it wasn't included in the tarball of the old documentation and needs to be located and added into the repo, else linked in from another location.

I have traced the content from Andy's hosted docs back to the following directory: https://github.com/ajheaps/ajheaps.github.io/tree/master/cf-view/videos. So I'll download that and upload to this repo in the right location.

Break Mudit's list of todos into single issues

To Do

# View Data - Column and Row Titles
# View Data - Fix Scrolling Issue (Scroll to the very end)
# View Data - Information about the field
# View Maps - Option to load a single map in the default pop out window
# View Maps - Option to view data from a map
# View Maps - Load map from file
# Select Data - More output messages, e.g. when loading in a file
# View Maps - Map name is displayed on top of the area
# Select Data - Stash Code is displayed along with the field names
# Menu Bar - Options e.g. Zoom power, plot options
# Menu Bar - Save/Convert?
# View Maps - Zoom in and out towards centre
# Select Data - Button to make maps for all Z values
# Select Data - Other options from CF Plot

Contour options don't play nicely with each other.

The setup options for contours do not play nicely.

Consider the following sequence of events:

  1. Default contour map. Plot.
  2. Change number of contour intervals to 6 (setup/contours). Plot.
  3. Change to user set contour levels (e.g min, max, step in setup/contour_levels). Plot.
  • at this point you get six contour intervals rather than than (max-min)/step +1 ... and the maximum chosen is not obvious, although the minimum is honoured.
  1. You can go back and reset the number of contour intervals, and then plot, and you get the user set contour levels honoured.

These menus should be combined in some way so that odd results are not obtained.

Remove duplicate README

There are currently two files with the filename README in the root of the repository, one with .txt and one with .md as extensions. We should remove one, as having two in the repository root is confusing and only one gets rendered on the library homepage.

cf view fails to load with PIL error

Recent install of cf-view in a docker container fails with:

from PIL.ImageQt import ImageQt
ImportError: cannot import name 'ImageQt' from 'PIL.ImageQt' (/opt/conda/envs/datatools/lib/python3.12/site-packages/PIL/ImageQt.py). Did you mean: 'Image'?

The Dockerfile for reproduction is:

FROM condaforge/mambaforge

#Update and install extra tools.
RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get -y install qt5-default graphviz plantuml

#mamba update and emsvaltool
RUN mamba update -y conda mamba pip && mamba create -y --name datatools 

#set conda env
SHELL ["conda", "run", "--name", "datatools", "/bin/bash", "--login", "-c"]

#cf-python and other tools
RUN mamba install -c conda-forge cf-python cf-plot ipython gcc gfortran gdb make cmake libtool && conda clean --all -y
RUN pip install cf-view #Not yet in conda

#nuke dash
RUN rm /bin/sh&&ln -s /bin/bash /bin/sh

ENV PYTHONNOUSERSITE=1

RUN echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc&&echo "conda activate datatools" >> ~/.bashrc

Which is then run with: docker run -e DISPLAY=host.docker.internal:0 -it ncas/dtools24:v1 and within the container: cfview.

add -h and -V options

I suggest adding the command-line options -h (or --help) for help message and -V (or --version) to display version info, as people will tend to assume that these exist.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.