GithubHelp home page GithubHelp logo

dlotter's Introduction

Master Develop
Lint Lint Master Lint Develop

dlotter

Plot data from NWP output (BETA - in development).
The "word" dlotter is a contraction of DMI and Plotter.

Install

Installation should be relatively simple.

Install using pip: pip install dlotter

One dependency is "cartopy". pip installation of cartopy seems to be currently broken, thus leads to a failed installation of dlotter. If this happens, either build cartopy from source or with conda (see section "Prerequisites").

Usage

Submodules can be imported, but this software is designed to be used as a CLI (Command-Line-Interface), by calling the __main__ module. See examples on the wiki page: https://github.com/dmidk/dlotter/wiki

python -m dlotter: Prints a help message

python -m dlotter plot: Calls the plot submodule and prints a help message (as flags are needed for this command to work)

python -m dlotter plot -p t2m:w10m -d /path/to/grib2/files/ --filetype grib2 --verbose: Plots t2m and w10m from grib2 files in the directory specified.

python -m dlotter plot -p t2m:w10m -d /path/to/grib2/files/ --prefix 0 --filetype grib2 --limit-files 4 --verbose: Limits to use the first 4 files sorted by name and only use files starting with "0" in their name.

python -m dlotter plot -p t2m:w10m -d /path/to/netcdf/files/ --postfix .nc --filetype netcdf --verbose: Plots data from netcdf files with the postfix ".nc" in the directory specified.

Flags and commands

'-a' or '--area' dk,neu
'-d' or '--directory' /path/to/files/
'-p' or '--parameters' t2m:w10m:precip:slp:td2m:tcc:lmhc

areas:

  • dk: Denmark
  • neu: Northern Europe
  • gl: Greenland
  • disko: Disko Bay
  • sjalland: Zealand
  • europe: Europe
  • faroes: Faroe Islands
  • scoresbysund: Scoresbysund (Greenland)

Parameters:

  • t2m: 2 Meter Temperature
  • w10m: 10 Meter Wind Speed
  • precip: Accumulated Precipitation
  • slp: Sea Level Pressure
  • td2m: 2 Meter Dewpoint Temperature
  • tcc: Total Cloud Cover
  • lmhc: Low, Medium, High clouds

Important assumptions

  • All files should be in the same projection. This is to speed up the plotting.
  • All files will be plotted in the same domain. This is also to speed up plotting.
  • All data at one time are in the same file

Prerequisites

dlotter is a script tool based on python. Dependencies is defined in dlotter.yml and a python environment can be made using (mini)conda:

conda env create -f dlotter.yml

Build package

To build from the source code:

python setup.py sdist bdist_wheel

To install locally:

pip install dist/dlotter-$VERSION-py3-none-any.whl --upgrade

To deploy to PyPi (Only users with access can do this):

python -m twine upload dist/*

dlotter's People

Contributors

ealerskans avatar khintz avatar sbnielsen avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sebpelt90

dlotter's Issues

No checks for filetype

The program opens all files in a directory matching the searching criteria. It the file is not matching filetype it will fail.
Instead it should check the type of file and ignore if not matching filetype

Units are assumed

Currently, we assume that fields are in certain units. For example, wind speed is assumed to be in m/s. This should be checked when reading the input and carried along throughout the code.

Building wheels

Building wheels for dlotter currently fails with the following error message:

Building wheels for collected packages: dlotter
  Building wheel for dlotter (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [68 lines of output]
      /home/ea/miniconda3/lib/python3.11/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!
      
              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************
      
      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib
      creating build/lib/dlotter
      copying dlotter/plot.py -> build/lib/dlotter
      copying dlotter/comeps.py -> build/lib/dlotter
      copying dlotter/arguments.py -> build/lib/dlotter
      copying dlotter/meteogram.py -> build/lib/dlotter
      copying dlotter/utils.py -> build/lib/dlotter
      copying dlotter/read.py -> build/lib/dlotter
      copying dlotter/prepare.py -> build/lib/dlotter
      copying dlotter/__main__.py -> build/lib/dlotter
      copying dlotter/__init__.py -> build/lib/dlotter
      copying dlotter/plotdiff.py -> build/lib/dlotter
      running egg_info
      writing dlotter.egg-info/PKG-INFO
      writing dependency_links to dlotter.egg-info/dependency_links.txt
      writing requirements to dlotter.egg-info/requires.txt
      writing top-level names to dlotter.egg-info/top_level.txt
      reading manifest file 'dlotter.egg-info/SOURCES.txt'
      adding license file 'LICENSE'
      writing manifest file 'dlotter.egg-info/SOURCES.txt'
      /home/ea/miniconda3/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
      !!
      
              ********************************************************************************
              Please avoid running ``setup.py`` directly.
              Instead, use pypa/build, pypa/installer or other
              standards-based tools.
      
              See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
              ********************************************************************************
      
      !!
        self.initialize_options()
      installing to build/bdist.linux-x86_64/wheel
      running install
      running install_lib
      creating build/bdist.linux-x86_64
      creating build/bdist.linux-x86_64/wheel
      creating build/bdist.linux-x86_64/wheel/dlotter
      copying build/lib/dlotter/plot.py -> build/bdist.linux-x86_64/wheel/dlotter
      copying build/lib/dlotter/comeps.py -> build/bdist.linux-x86_64/wheel/dlotter
      copying build/lib/dlotter/arguments.py -> build/bdist.linux-x86_64/wheel/dlotter
      copying build/lib/dlotter/meteogram.py -> build/bdist.linux-x86_64/wheel/dlotter
      copying build/lib/dlotter/utils.py -> build/bdist.linux-x86_64/wheel/dlotter
      copying build/lib/dlotter/read.py -> build/bdist.linux-x86_64/wheel/dlotter
      copying build/lib/dlotter/prepare.py -> build/bdist.linux-x86_64/wheel/dlotter
      copying build/lib/dlotter/__main__.py -> build/bdist.linux-x86_64/wheel/dlotter
      copying build/lib/dlotter/__init__.py -> build/bdist.linux-x86_64/wheel/dlotter
      copying build/lib/dlotter/plotdiff.py -> build/bdist.linux-x86_64/wheel/dlotter
      running install_data
      creating build/bdist.linux-x86_64/wheel/dlotter-0.0.2.2.data
      creating build/bdist.linux-x86_64/wheel/dlotter-0.0.2.2.data/data
      creating build/bdist.linux-x86_64/wheel/dlotter-0.0.2.2.data/data/dlotter
      error: can't copy 'dlotter/icons/*': doesn't exist or not a regular file
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dlotter
  Running setup.py clean for dlotter
Failed to build dlotter
ERROR: Failed to build one or more wheels

Furthermore, there is a dependency missing; netcdf4. This should be added to setup.py

     install_requires=[
         'wheel',
         'dmit',
         'xarray',
         'numpy',
         'netcdf4',
         'cartopy',
         'eccodes',
         'pygrib',
         'scipy',
         ],

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.