Home > Mobile >  ERROR: MethodError: objects of type Tuple{} are not callable
ERROR: MethodError: objects of type Tuple{} are not callable

Time:10-27

I have never used Julia and I am following a tutorial. I have reached an instruction that are written below. When I tried the Lon3D, Lat3D,Depth3D =LonLatDepthGrid(lon,lat,depth) I got and error saying ERROR: UndefVarError: LonLatDepthGrid not defined I tried creating the variable using LonLatDepthGrid =() I ran the Lon3d.... command again then got the following error * MethodError: objects of type Tuple{} are not callable* What am I missing???? THanks K

Here is the order in which I am defining variables:

lat = ncread("APVC.ANT RF.Ward.2014_kmps.nc","latitude")
lon = ncread("APVC.ANT RF.Ward.2014_kmps.nc","longitude") 
depth = ncread("APVC.ANT RF.Ward.2014_kmps.nc","depth")
Vs_3D = ncread("APVC.ANT RF.Ward.2014_kmps.nc","vs")
depth = -1 .* depth
Lon3D,Lat3D,Depth3D = LonLatDepthGrid(lon, lat, depth);

I tried creating the variable using LonLatDepthGrid =() I ran the Lon3d.... command again then got the following error * MethodError: objects of type Tuple{} are not callable* What am I missing???? THanks K

CodePudding user response:

You created a tuple called LonLatDepthGrid:

julia> LonLatDepthGrid =()

julia> typeof(LonLatDepthGrid)
Tuple{}

But then you tried to use the tuple as a function:

julia> LonLatDepthGrid(...)
ERROR: MethodError: objects of type Tuple{} are not callable

Also, it's difficult to help you further without knowing what the packages you're using...

CodePudding user response:

Please read the Julia documentation about installing packages from their repositories.

GeophysicalModelGenerator.jl needs to be installed:

julia> ]add GeophysicalModelGenerator

...

julia> using GeophysicalModelGenerator

Now this should compile:

Lat         =   1.0:3:10.0;
Lon         =   11.0:4:20.0;
Depth       =   (-20:5:-10)*km;
Lon3D,Lat3D,Depth3D = LonLatDepthGrid(Lon, Lat, Depth);
  • Related