Hi first question on stackoverflow.
I've been stuck on this for 5 days. I want to write a netcdf file in Fortran.
I'm using netcdf/3.6.3 I am trying to output a large 43000x 18000 array named frech and some smaller ones (1d arrays).
a sample of my code is below it is a really large file and the problem is not in putting in values for the variables the problem is ending the definition of variables:
print*,"nunks is",nunks
print*,"neqns is",neqns
ok=nf90_create('michalek.nc', NF90_CLOBBER, ncid)
print *,"create ok=",ok
ok= nf90_def_dim(ncid,"nunks", nunks, nunks_dimid)
print *,"def nunks dimension ",ok
ok= nf90_def_dim(ncid,"neqns", neqns, neqns_dimid)
print *,"def neqns dimension ",ok
dimids=(/neqns_dimid, nunks_dimid/)
print *,dimids
ok= nf90_def_var(ncid,"frech", NF90_REAL, dimids, frech_varid)
print *,"def frech",ok
ok= nf90_def_var(ncid,"src", NF90_REAL, nunks_dimid, src_varid)
print *,"def src",ok
ok= nf90_def_var(ncid,"csrc", NF90_REAL, nunks_dimid, csrc_varid)
print *,"define csrc",ok
ok= nf90_def_var(ncid,"dat", NF90_REAL, neqns_dimid, dat_varid)
print *,"define dat",ok
ok= nf90_def_var(ncid,"cdat", NF90_REAL, neqns_dimid, cdat_varid)
print *,"define cdat",ok
ok= nf90_enddef(ncid)
print *,"end dif ", ok
ok= nf90_put_var(ncid, frech_varid, frech)
print *, 'frech put in ok=',ok
ok= nf90_put_var(ncid, src_varid, src)
print *, 'src put in ok=',ok
ok= nf90_put_var(ncid, csrc_varid, csrc)
print *, 'csrc put in ok=',ok
ok= nf90_put_var(ncid, dat_varid, dat)
print *, 'dat put in ok=',ok
ok= nf90_put_var(ncid, cdat_varid, cdat)
print *, 'cdat put in ok=',ok
ok= nf90_close(ncid)
print *, 'close?',ok
I understand that ok=0 when the file is correctly read However when I get to the stage of ending the defintions of the file (nf90_enddif) ok is returned as =-62 and the netcdf file is not created. I imagine its a problem with a too large array but I can't fix this problem
the relevant output for the above code is:
nunks is 43894
neqns is 18144
create ok= 0
def nunks dimension 0
def neqns dimension 0
2 1
def frech 0
def src 0
define csrc 0
define dat 0
define cdat 0
end dif -62
frech put in ok= -39
src put in ok= -39
csrc put in ok= -39
dat put in ok= -39
cdat put in ok= -39
close? -62
Thanks for any help!
Regards Peter :)