[gradsusr] netcdf - descriptor file ctl
Celso Bandeira de Melo Ribeiro
celso.bandeira at ufjf.edu.br
Mon Sep 30 15:13:45 EDT 2013
Hi Andrew,
I used the follow commands:
% Create a netCDF file
ncid = netcdf.create(sprintf('ET_%dM0%d.nc',year,month),'NC_WRITE');
% Define a dimension in the file (must give it a name and length or
use NC_UNLIMITED)
dimidrow = netcdf.defDim(ncid,'rows',numrow);
dimidcol = netcdf.defDim(ncid,'length',numcol);
% Define a variable on the dimension (must give it a name,data
type,and a dimension ID).
varid = netcdf.defVar(ncid,'ET','NC_DOUBLE',[dimidrow dimidcol]);
% Take the netCDF file out of define mode. To write data to a file,
you must be in data mode.
netcdf.endDef(ncid);
netcdf.putVar(ncid,varid,q_netcdf);
netcdf.close(ncid);
Celso
On Sun, 29 Sep 2013 16:19:59 -0700, Andrew Friedman
<andfried at berkeley.edu>
wrote:
> Hi Celso,
> Can you post what commands you used to write the netcdf file in matlab?
> Andrew
>
> On Sep 29, 2013, at 7:46 AM, Celso Bandeira de Melo Ribeiro
> <celso.bandeira at ufjf.edu.br> wrote:
>
>> Hello,
>>
>> Could someone please help me out?
>>
>> I am using a netcdf file that I created using matlab. However, I am
still
>> having trouble defining the .ctl file. The file contains just one
>> variable
>> i.e. ET. I am having trouble defining 'VARS' in the .ctl file. I am
>> attaching my file with this email. Following is the .ctl file that I
was
>> trying to use
>>
>> DSET ^ET_2000M01.nc
>> UNDEF -3277
>> XDEF length 652 LINEAR -80.05 0.05
>> YDEF rows 527 LINEAR -20.25 0.05
>> *XDEF dimension1 651 LINEAR -80.05 0.05
>> *YDEF dimension2 526 LINEAR -20.25 0.05
>> *DTYPE netcdf
>> VARS 1
>> ET=>ET 1 99 ET
>> ENDVARS
>>
>> When I try to display ET, I get the following error
>>
>> gancgrid error: nc_get_vara_double failed; NetCDF: Start+count exceeds
>> dimension bound
>> Data Request Error: Error for variable 'et'
>> Error ocurred at column 1
>> DISPLAY error: Invalid expression
>> Expression = et
>>
>> Thank you very much,
>> Celso
>>
>>
>> ____________________________________________
>> Prof. Celso Bandeira de Melo Ribeiro
>> Universidade Federal de Juiz de Fora - UFJF
>> Faculdade de Engenharia, Plataforma 4
>> Departamento de Engenharia Ambiental e Sanitaria
>> Bairro Martelos, Juiz de Fora (MG) CEP. 36036-900
>> tel. (32)
>> 2102-3400<ET_2000M01.nc>_______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
--
More information about the gradsusr
mailing list