Coder Social home page Coder Social logo

xcroco's People

Contributors

jaard avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xcroco's Issues

Error when using vslice

Hi there,

Thank you for creating the set of tools, it's great to have python tools for post-processing CROCO output. I have run into a few issues with the vslice function.

Here is the code snippet:

Setting the correct paths (where the data is stored)

import numpy as np
import xarray as xr
from glob import glob
import xcroco as xco

#Loading CROCO files
model_path = glob('/media/matthew/Cerberus1/Run_False_Bay_2008_2018_SANHO/croco_avg_Y2008M1.nc.1')
grid_path = '/home/matthew/confs/Run_False_Bay/CROCO_FILES/croco_grd.nc.1'
D = xco.croco_dataset(model_path, grid=grid_path)
#Compute depths
z = D.z_rho.compute()
z = D.z_w.compute()
z = D.z_u.compute()
z = D.z_v.compute()

Extract section

Npoints = 40
lat_ends = [-33.53,-34.55]
lon_ends = [19.0,19.5]
lats = np.linspace(lat_ends[0], lat_ends[1], Npoints)
lons = np.linspace(lon_ends[0], lon_ends[1], Npoints)
sec = xr.Dataset()
sec['temp'] = xco.vslice(D, D.temp, lat_rho=lats, lon_rho=lons).compute().load()
sec['temp_interp'] = xco.vslice(D, D.salt, lat_rho=lats, lon_rho=lons, zlevels=np.arange(-500,0.1)).compute().load()
sec

#Error
I get the following error:
TypeError: Using a DataArray object to construct a variable is ambiguous, please extract the data using the .data property.

I have managed to get the section by adding .data at various points in the source code but this is obviously not ideal. Can you suggest any fixes?

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.