Giter Site home page Giter Site logo

python-oceans's People

Contributors

apaloczy avatar arnaldorusso avatar dependabot[bot] avatar kthyng avatar michelly-gc avatar ocefpaf avatar rosmesquit avatar rsignell-usgs avatar xiaoxiaoyu0302 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-oceans's Issues

@efiring's review and suggestions for `gamma_GP_from_SP_pt.py`

(Trivial first aesthetic tweak: use a list comprehension or generator in the first line. But maybe all this would be handled in a decorator eventually anyway.)

In this case, the simplest change I would make is to leave the coefficient tables as lists of lists, or lists of tuples. Converting to ndarrays is not helping anything, and is actually adding a tiny bit of overhead.

The loops could use the more idiomatic form:

gamma = np.zeros_like(SP)
for i, j, c in Fit:
    gamma += c * (SP**i * pt**j)

Going farther, I would take all the Fit tables out of the functions, make them named module-level variables, and probably collect them in a dictionary. (Same for the polygons, which I would probably save as 2-D ndarrays--I think shapely can handle them efficiently.) Then I would use a single function to handle the loop, with the Fit table as a third argument. This would allow for future optimization of that single critical function, if desired; it would clarify the common logic; it would minimize repetition; and it would be slightly faster because all the table initialization would be done only once, at import time.

Additionally, I would look at the main function to see whether it is really necessary to calculate gamma for all the oceans; I suspect one could calculate weights first, and omit the gamma calculation for any region with zero weight.

Is some normalization of the input lat/lon range needed to make everything work with the region polygons? Are there potential problems with crossing the dateline, or the prime meridian?

Check np.nan inside array

Hi @ocefpaf,
How should be the properly way to check the existence of nans inside any of arrays used to compute variables?

I have found match_args_return but this do not do the job; or at least I did not find the desired results.

from oceans.utilities import match_args_return
a = np.array([0, 1, np.nan, 2, 3, np.nan])
match_args_return(a)

returns an AttributeError:

      29         self.func = func
      30         self.__doc__ = func.__doc__
---> 31         self.__name__ = func.__name__
      32 
      33     def __call__(self, *args, **kw):
      AttributeError: 'numpy.ndarray' object has no attribute '__name__'

This kind of masking (where each of the function input arrays are masked based on other input) should be defined inside python-oceans or it's better let the users define it?

Re-write `woa_subset` to use iris.cube instead of Panel4d

@arnaldorusso I am a little swamped by work right now and I cannot investigate what is happening with woa_subset. It might be just a server issue, and restarting travis-ci would fix it, or some variable name might have changed... Anyways, I have plans to re-write woa_subset completely using iris instead of the hackish function we have now.

If you want to:

  • try to find the problem and fix it or,
  • re-write the function
    feel free to bug me later.

Pyflakes issues

Hi Filipe,
Are you aware about those errors?

sw_extras.py|777 col 1 error| E0602 undefined name 'swstate' [pyflakes]
sw_extras.py|782 col 1 error| E0602 undefined name 'swstate' [pyflakes]
sw_extras.py|783 col 1 error| E0602 undefined name 'swstate' [pyflakes]
sw_extras.py|784 col 1 error| E0602 undefined name 'adiabattempgrad' [pyflakes]

O2SAT

Check Weiss 1970 table

Write docs

At least some basic module descriptions...

Make conversion to theta optional in spice?

I'm thinking that the conversion from T to theta in spice should be an optional feature. I imagine it is assumed for observational data that T is in situ T. However, a lot of model output comes out as theta (potential temperature).

Maybe it would be good to add theta=False at the end, then for the following lines, wrap with if not theta:

# FIXME: I'm not sure about this next step.
pt = sw.ptmp(s, t, p)

Also this must be referencing an old version of seawater. sw.ptmp doesn't exist now. I believe it's now temppot.

I'm happy to implement all this if it makes sense and this package is still actively developed.

Can't find the "seawater.py" routine ?

Hello,

I can't find the subroutine "seawater.py", which is essential to calculate several parameters from the routine sea_extras.py.

Thank you in advance

Hugo D

Any interest in some basic vector calculations? Also what about pandas?

I need to write some basic vector calculations (u, v from speed, dir; rotations; etc) and I need them multiple places so it might be nice to officially have these somewhere. Additionally I would add metadata for new variables for DataArrays.

But that also begs the question โ€” could this package work for both incoming xarray Datasets and pandas DataFrames? That sounds useful.

What do you think @ocefpaf?

Academic usage

Hi Filipe,

Do you intend to improve this package and turn it more popular for academic usage?
If you think it could be nice, I can push myself a little to pump it out.

Cheers,
Arnaldo.

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.