teos-10 / python-gsw Goto Github PK
View Code? Open in Web Editor NEWPython implementation of the Thermodynamic Equation Of Seawater - 2010 (TEOS-10)
License: MIT License
Python implementation of the Thermodynamic Equation Of Seawater - 2010 (TEOS-10)
License: MIT License
The following locations should return valid salinity assuming the data was collected in a lake.
gsw.SA_from_SP(0.1, -0.5, -70, 40) # PA coords
gsw.SA_from_SP(0.1, -0.5, -100, 40) # KS coords
From McDougall (2012):
If the latitude and longitude are such as to place the observation well away from the ocean, a flag ‘in_ocean’ is set to zero as a warning, otherwise it is 1. This flag is only set when the observation is well and truly on dry land; often the warning flag is not set until one is several hundred kilometers inland from the coast. When the function detects that the observation is not from the ocean, Rδ is set equal to zero and gsw_Sstar_from_SP returns S* = SR = (35.165 04 g kg−1/ 35) SP in accordance with Eqn. (3).
Latest Matlab version is out. Time to get back to work!
@paloczy Do you have to some to volunteer for this project? We are low on man power here!!!
check_functions.py is showing 5 functions with test output that doesn't match the check values:
I suspect that at least the last 4 of these were written based on an earlier Matlab version, and there have been considerable changes in the Matlab code for the freezing point calculations. I don't know whether the problem with enthalpy_second_derivatives
is also because of a change between Matlab versions, or something else.
We still have to figure out an efficient way of handling docstrings--something that doesn't require hand-editing a couple hundred chunks of text. What we have so far is a hodge-podge. Until we figure out a good mechanism--I have some rough ideas and some helper code--I think the thing to do is just concentrate on the actual function code rather than spend time on editing docstrings.
@efiring I believe that the code you mentioned is this one, correct?
https://github.com/TEOS-10/python-gsw/blob/master/gsw/test/signatures.py
The PRs are being tested and shown on GitHub, but the current
https://travis-ci.org/TEOS-10/python-gsw
Does not show any builds. I do not have admin rights to fix this.
Hi everyone,
Many thanks for maintaining this important package. I am currently writing up a manuscript and would like to cite this package. Could you provide some guidance, how to do this best? I did not see a DOI right away.
Thanks
Would it be possible to submit a new version to PYPI? It would make continuous integration in other projects easier.
I was talking to the authors of TEOS-10 (McDougall and Barker) and they were saying that there are errors in the Python implementation of TEOS-10 contained in this repo. They say that the only trustworthy versions of TEOS-10 code (for any language) are found at the TEOS-10 website (i.e. and not on GitHub at the TEOS-10 organisation page).
Since they have a C version of the code available at the TEOS-10 website, I'm wondering if anyone is planning to write a python wrapper for it?
In the meantime, should this repo be taken down? I know people (including myself) who install gsw as follows, completely unaware of any errors with the code:
conda config --add channels conda-forge
conda install gsw
The following code is causing gsw
v. 3.0.2 to crash:
import gsw
gsw.SA_from_SP(27,10,-50,70)
with the error: IndexError: too many indices
on line 128 of library.py:
https://github.com/ocefpaf/python-gsw/blob/master/gsw/gibbs/library.py#L128
That line is performing operations on w
and valid
, which look like:
ipdb> print w; print valid
[[ 0.75]
[ 0. ]
[ 0. ]
[ 0.25]]
[ True]
Get testing and travis-ci working.
Hi, I'm a Python User and a saw that this function isn't in the library yet.
Do you know if a traduction will be made ?
Thanks for you work
This makes reviews much faster because stickler
will comment on the PRs saving the human reviewer time. See https://stickler-ci.com/ for more information and https://github.com/python-visualization/folium/pull/602/files/5ec18b1c200500c098d5ebb9dd6fce35f91afeab for an example.
PS: I cannot enable it here. I guess that only @PaulMBarker has the TEOS-10 organization rights to do so.
Nsquared function for a 2-d array in gsw/gibbs/water_column_48.py gives correct values when the "sea pressure", "Absolute Salinity" and "Conservative Temperature" are given as an array in which pressure change is in rows.
Instead if the inputs are given as an array in which pressure is given in columns then the calculated 'N2' gives 'inf' values.
This was not mentioned in documentation or in the code comments.
In code the values for ishallow and ideep are calculated as follows.
ishallow = (slice(0, -1), Ellipsis)
ideep = (slice(1, None), Ellipsis)
which slices rows but all the values of columns are being taken. Thus, it doesn't work when given in columns.
For Eg.:
import numpy as np
import gsw
SA = [[35, 35.1, 35.2, 35.3, 35.4], [35.15, 35.6, 35.8, 35.2, 35.9]]
CT = [[26.5, 26.3, 26.2, 26.1, 26], [26.9, 26.2, 26.8, 26.6, 26.15]]
sea_pressure = [[-3, -7.5, -12.5, -17.5, -25],[-3, -7.5, -12.5, -17.5, -25]]
lat = 15
[N2_1, p_mid_1] = gsw.Nsquared(SA, CT, sea_pressure, lat)
[N2_2, p_mid_2] = gsw.Nsquared(np.transpose(SA), np.transpose(CT), np.transpose(sea_pressure), lat)
print N2_1
print N2_2
Output:
[[-inf inf inf -inf inf]]
[[ -2.90694938e-04 -1.17676546e-03]
[ -2.01312134e-04 8.08101340e-05]
[ -2.01236464e-04 7.25545252e-04]
[ -1.34105985e-04 -8.40277657e-04]]
It would be better if the code is written accordingly or mention it in the comments of code or include in the documentation.
I am uploading the docs to https://ocefpaf.github.io/python-gsw/ because I do not have rights to add a deploy key here. @PaulMBarker could you expand our rights to this repo so we can do #33 and the docs?
I believe that pypi is outdated in respect to the GitHUB, despite both are 3.0.3.
The pypi version does not have scipy in "install_requires", what makes it to crash on import if scipy is not available.
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.