ncas-cms / cf-view Goto Github PK
View Code? Open in Web Editor NEWExploration and plotting GUI for netCDF and Met Office format data
Home Page: https://ncas-cms.github.io/cf-view/build/
License: MIT License
Exploration and plotting GUI for netCDF and Met Office format data
Home Page: https://ncas-cms.github.io/cf-view/build/
License: MIT License
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 ...
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.
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.
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.
Version 3.3.0
if you haven't loaded any data, then view properties stack dumps in the output messages. We should handle that more gracefully.
... haven't thus far because there isn't enough real estate ...
(and how to handle plotting when user selects multiple fields)
Should modularise a little bit more, and try and add some unit tests
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.
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.
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.
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).
Can we make it non-blocking?
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.
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.
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'
And move all the links in the various setup, readme, etc code.
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'
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.
# 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
The setup options for contours do not play nicely.
Consider the following sequence of events:
These menus should be combined in some way so that odd results are not obtained.
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.
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
.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.