[Scilab-users] Using Scinetcdf module

Harpreet Singh Rathore harpreet.mertia at gmail.com
Fri Feb 5 11:46:50 CET 2016


Hey

You have not created the variable in the file. First you have to create a
variable in the following file using the command nccreate(filename,
'Hilb_Hy', 'Dimensions', list('r', no_row, 'c', no_column); after that you
can pass the ncwrite command and you have to pass like this ncwrite(filename,
'Hilb_Hy',Hy) as Hy is a matrix.

Regards
Harpreet Singh

On Fri, Feb 5, 2016 at 4:01 PM, Lester Anderson <arctica1963 at gmail.com>
wrote:

> Hello Harpreet,
>
> I altered the code a bit but still get a problem
>
> Hy = hilbert(grav);
> filename = fullfile('Q:\geophys\Gz_Hy.grd') // set output filename
> // ncwrite(filename, varname, vardata, [start, [stride]])
> ncwrite(filename, 'Hilb_Hy','Hy') // write variable Hilb_Hy with data from
> Hy
>
> Error message:
>
> ncwrite(filename, 'Hilb_Hy','Hy') // write variable Hilb_Hy with data from
> Hy
>                                   !--error 999
> ncwrite: nc_inq_varid() returned the error -49: NetCDF: Variable not found.
> at line       6 of exec file called by :
> exec('Q:\geophys\Lester\SCILAB_work\netcdf1.sce', -1)
>
> In this case I want to define a variable name Hilb_Hy (although can
> use any name really) in the netCDF file and write the output of the
> Hilbert (Hy) transform.
>
> Cannot see the solution
>
>
>
> On 5 February 2016 at 10:15, Harpreet Singh Rathore
> <harpreet.mertia at gmail.com> wrote:
> > Dear Lester,
> >
> > As I can see the error is saying minimum 3 inputs are required. And after
> > going through the help of the following function, you also have to pass
> the
> > value which you have to store in the 'Hy'. You can go through the help
> files
> > of ncwrite by typing help ncwrite in the console.
> >
> > Regards
> > Harpreet
> >
> > On Fri, Feb 5, 2016 at 3:18 PM, Lester Anderson <arctica1963 at gmail.com>
> > wrote:
> >>
> >> Hello all
> >>
> >> I am looking to use the sciNetCDF module to work with GMT grid files
> >> but have some issues.
> >>
> >> Reading a GMT grid is not a problem as far as I can tell, so the
> >> following does read the file (and z variable), storing the values in
> >> the grav array:
> >>
> >> source = fullfile('Q:\geophys\Gz.grd')
> >> grav = ncread(source,'z')
> >> Hy = hilbert(grav); // write Hy variable to new file
> >>
> >> I am having problems with writing out the processed data e.g write a
> >> new grid (Gz_Hy.grd) with the Hilbert transform solution
> >>
> >> filename = fullfile('Q:\geophys\Gz_Hy.grd')
> >> ncwrite(filename, 'Hy') // does not work
> >>
> >> Error return:
> >>
> >> ncwrite(filename, 'Hy')
> >>                        !--error 77
> >> ncwrite: Wrong number of input argument(s): 3 to 5 expected.
> >> at line       5 of exec file called by :
> >> exec('Q:\geophys\Lester\SCILAB_work\netcdf1.sce', -1)
> >>
> >> Any advice would be appreciated.
> >>
> >> Thanks
> >> Lester
> >> _______________________________________________
> >> users mailing list
> >> users at lists.scilab.org
> >> http://lists.scilab.org/mailman/listinfo/users
> >
> >
> >
> >
> > --
> > Thanks and Regards
> > Harpreet Singh
> >
> > _______________________________________________
> > users mailing list
> > users at lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> >
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>



-- 
Thanks and Regards
Harpreet Singh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160205/62b5ba90/attachment.htm>


More information about the users mailing list