Giter VIP home page Giter VIP logo

pyhector's Introduction

openclimatedata

Installation

pip install openclimatedata

pyhector's People

Contributors

rgieseke avatar swillner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyhector's Issues

Update tests

Hector added a number of tests using its R wrapper.

We should add these too (or some of them).

Introducing new output variables sometimes errors

But not predictable ...

pytest tests/test_pyhector.py::test_output_variables

================ test session starts ================
platform linux -- Python 3.5.3, pytest-3.3.2, py-1.5.2, pluggy-0.6.0
rootdir: /home/robert/openclimatedata/pyhector, inifile: setup.cfg
plugins: cov-2.5.1
collected 1 item

tests/test_pyhector.py F

===================== FAILURES
___________ test_output_variables

    def test_output_variables():
        results = pyhector.run(rcp26)
        assert len(results.columns) == 3
>       results = pyhector.run(rcp26, outputs="all")

tests/test_pyhector.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyhector/__init__.py:414: in run
    h.run()
pyhector/__init__.py:134: in run
    self._check(self.__run_size)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pyhector.Hector object at 0x7f3e03beb828>, v = -1

    def _check(self, v):
        if v < 0:
>           raise HectorException(_lib.hector_get_last_error())
E           pyhector.HectorException: b'Assertion failed: units mismatch'

pyhector/__init__.py:129: HectorException
============= 1 failed in 0.46 seconds ===============================

Add __version__ attribute

Options:

Python-Git-Version

https://github.com/aebrahim/python-git-version

Python-Versioneer

This looks good:

This is a tool for managing a recorded version number in distutils-based python projects. The goal is to remove the tedious and error-prone "update the embedded version string" step from your release process. Making a new release should be as easy as recording a new tag in your version-control system, and maybe making new tarballs.

https://github.com/warner/python-versioneer

Stackoverflow Discussion

http://stackoverflow.com/questions/17791481/creating-a-version-attribute-for-python-packages-without-getting-into-troubl

Fix notebook

  • variables -> output
  • update binder badge to beta

Problem with PyBind on ARM Mac OS 10.14

This line of code is failing to compile:

array.reset(new py::array_t<double>{{values.size()}, data, handle});

I don't know enough about PyBind to figure it out.

clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Iinclude -Ihector/inst/include -I/Users/james/pyhector/venv/lib/python3.8/site-packages/pybind11/include -I/Users/james/pyhector/venv/lib/python3.8/site-packages/pybind11/include -I/Users/james/pyhector/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c src/Observable.cpp -o build/temp.macosx-10.14-arm64-3.8/src/Observable.o -std=c++11 src/Observable.cpp:87:42: error: non-constant-expression cannot be narrowed from type 'std::vector<double>::size_type' (aka 'unsigned long') to 'pybind11::ssize_t' (aka 'long') in initializer list [-Wc++11-narrowing] array.reset(new py::array_t<double>{{values.size()}, data, handle}); ^~~~~~~~~~~~~ src/Observable.cpp:87:42: note: insert an explicit cast to silence this issue array.reset(new py::array_t<double>{{values.size()}, data, handle}); ^~~~~~~~~~~~~ static_cast<ssize_t>( ) src/Observable.cpp:87:41: warning: braces around scalar initializer [-Wbraced-scalar-init] array.reset(new py::array_t<double>{{values.size()}, data, handle}); ^~~~~~~~~~~~~~~ 1 warning and 1 error generated. error: command 'clang' failed with exit status 1

Trouble installing

Hi,

I am trying to install pyhector on my mac OS X 10.11. I'm having some issues, see below. It's not able to find emplace_back and std::stop, plus the "error: command 'usr/bin/clang' failed with exit status 1". Googling around, it looked like maybe this is something related to libstdc++, but I couldn't figure out how to deal with it. Any help appreciated, thanks!

pyhector_install

Parse units in ini files

H0=35.0,pptv ; preindustrial concentration, pptv

See also JGCRI/hector#79

  • requires adding a field 'unit' to config object

Do we need changes on the C++ side, @swillner? Or is this ignored anyway? We could also compare with an expected unit on the Python side if we wanted ...

Logging re-enabled

On a clean checkout I get logging output from Hector, not sure whether it's a change here, upstream, or in hector-wrapper.

Output variables requiring date?

The following output variables fail with something like

PyHectorException: b'Assertion failed: Date required for atmospheric CH4'
  • OH.TAU_OH
  • ozone.O3
  • N2O.N2O
  • CH4.CH4

Rename output variables

Shorter, consistent names, e.g.

Maybe:
"temperature.Tgav" => "Surface_Temp_Global"

"simpleNbox.Ca" => "Conc_CO2"
"HFC227ea_halocarbon.hc_concentration" => "Conc_HFC227ea"

"forcing.Ftot" => "Forcing_Total"
"forcing.FCO2" => "Forcing_CO2"

Upper case desirable for standing out in Pandas DataFrames.
Camelcase oder under scores?

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.