Comments (10)
Hi, thank you for your interests. This is due to the recent update of xgcm
. A quick solution would be to use older version of xgcm
(< 0.7). I have to see how to recover the original behavior using the newest 'xgcm'.
from xinvert.
Thank you for your swift response. Upon downgrading to xgcm v 0.6.1 I unfortunately get the following warnings and error:
ds, grid = add_latlon_metrics(dset, dims={'lev':'LEV', 'lat':'lat', 'lon':'lon'})
C:\Users\user-pc\miniconda3\Lib\site-packages\xinvert\tests\GeoApps\GridUtils.py:177: FutureWarning: xarray.ufuncs is deprecated. Instead, use numpy ufuncs directly.
dx = xr.ufuncs.cos(xr.ufuncs.deg2rad(lat))
C:\Users\user-pc\miniconda3\lib\site-packages\xarray\core\dataarray.py:3078: FutureWarning: xarray.ufuncs is deprecated. Instead, use numpy ufuncs directly.
da = self.array_wrap(f(self.variable.data, *args, **kwargs))
C:\Users\user-pc\miniconda3\Lib\site-packages\xinvert\tests\GeoApps\GridUtils.py:177: FutureWarning: xarray.ufuncs is deprecated. Instead, use numpy ufuncs directly.
dx = xr.ufuncs.cos(xr.ufuncs.deg2rad(lat))
C:\Users\user-pc\miniconda3\lib\site-packages\xarray\core\dataarray.py:3078: FutureWarning: xarray.ufuncs is deprecated. Instead, use numpy ufuncs directly.
da = self.array_wrap(f(self.variable.data, *args, **kwargs))
C:\Users\user-pc\miniconda3\Lib\site-packages\xinvert\tests\GeoApps\GridUtils.py:177: FutureWarning: xarray.ufuncs is deprecated. Instead, use numpy ufuncs directly.
dx = xr.ufuncs.cos(xr.ufuncs.deg2rad(lat))
C:\Users\user-pc\miniconda3\lib\site-packages\xarray\core\dataarray.py:3078: FutureWarning: xarray.ufuncs is deprecated. Instead, use numpy ufuncs directly.
da = self.array_wrap(f(self.variable.data, *args, **kwargs))
C:\Users\user-pc\miniconda3\Lib\site-packages\xinvert\tests\GeoApps\GridUtils.py:177: FutureWarning: xarray.ufuncs is deprecated. Instead, use numpy ufuncs directly.
dx = xr.ufuncs.cos(xr.ufuncs.deg2rad(lat))
C:\Users\user-pc\miniconda3\lib\site-packages\xarray\core\dataarray.py:3078: FutureWarning: xarray.ufuncs is deprecated. Instead, use numpy ufuncs directly.
da = self.array_wrap(f(self.variable.data, *args, **kwargs))
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\user-pc\miniconda3\Lib\site-packages\xinvert\tests\GeoApps\GridUtils.py", line 87, in add_latlon_metrics
grid._assign_metrics(metrics)
AttributeError: 'Grid' object has no attribute '_assign_metrics'
from xinvert.
Sorry for this inconvience. The dependence of xinvert
on xgcm
is to take advantage of its ability for finite difference, but since xgcm
is still in heavy development, all the public apis can be changed at any time.
Could you please try 0.5.x of 'xgcm'? I write the codes using that version and I guess it should be OK.
from xinvert.
Ah...makes sense. Just downgraded to xgcm 0.5.0 and upon execution of the code this then comes up:
File "", line 1, in
File "", line 28, in
TypeError: init() got an unexpected keyword argument 'arakawa'
Is it because in the Dynamics class, the method init(self,dset,grid=None) doesn't take the grid type argument?
class Dynamics(Application):
"""
This class is designed for calculating the dynamical methods.
"""
def init(self, dset, grid=None):
from xinvert.
Oh, I notice that one may need GeoApps
to do the tests of xinvert
. You can clone it to your local path and import Dynamics
from the updated GeoApps
.
GeoApps
is used for finite differences but it is not ready for release. I realize that xinvert
has too many dependencies on those packages, and maybe it is time to make it standalone...
from xinvert.
I've just updated/cloned the GeoApps package into the tests folder, and again it throws the initial error I got before downgrading to an older xgcm version.
C:\Users\user-pc\miniconda3\lib\site-packages\scipy_init_.py:138: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.23.1)
warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion} is required for this version of "
Traceback (most recent call last):
File "", line 1, in
File "", line 20, in
File "C:\Users\user-pc\miniconda3\Lib\site-packages\xinvert\tests\GeoApps\GridUtils.py", line 175, in add_latlon_metrics
grid.set_metrics(key, value)
AttributeError: 'Grid' object has no attribute 'set_metrics'
Could this be related to the scipy and numpy warnings issued?
from xinvert.
I'll give a try to run this example using the newest versions of packages, fix all the bugs, and let you know the results ASAP.
from xinvert.
Awesome!, thanks for your help and patience.
from xinvert.
I've updated the test codes of QG omega, with 0.7.0v of xgcm
. Also, GeoApps
is updated accordingly. You can try with them.
For inverting QG omega, one needs a 3D forcing function and a 3D stratification. But the calculations of the forcing and stratification are not the part of xinvert
. There are two ways to do the calculation of forcings. One is to use GeoApps
which is based on xgcm
; the other is to use FiniteDiff
in xinvert
so that the package does not depend on other package (please see the cells in testOmegaEq.py
). You can also write your own codes to do the calculation of forcings.
Note that there are NaN in the calculation, which is used to maskout the topography (kwarg undef=NaN). In this case, one need to change inf
(the calculation of forcings usually brings up inf
) to NaN
explicitly so that inf
do not propagate in the calculation.
Once the forcings are ready, inverting is much easier. Please tell me if you find other problems.
from xinvert.
Close this now. Feel free to re-open it in any case.
from xinvert.
Related Issues (20)
- submit a JOSS paper HOT 1
- add a example of Stommel-Aron model for deep ocean circulation HOT 1
- add a example of Bretherton-Haidvogel model for 2D turbulence over topography HOT 1
- add a 2D reference state example HOT 1
- add a Fofonoff model HOT 1
- JOSS review: Installation HOT 5
- JOSS review: Automated tests HOT 12
- JOSS review: community guidelines HOT 3
- JOSS review: state of the field HOT 3
- Add installation instructions to the documentation HOT 15
- Software paper: Citation of python packages HOT 3
- Dependence on xcontour package HOT 3
- Re-running notebooks HOT 3
- add a vertical mode decomposition case HOT 1
- invert_omega: Need to pass N2 and f0 as dataArrays HOT 9
- 'dz' counts a lot HOT 9
- Lat-Lon Finite Differences HOT 4
- Broken link in readme HOT 2
- Pressure perturbation equation HOT 1
- a constants module HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xinvert.