pro write_ncvar, infile, dn, d ;==================================================== ; Check arguments ;==================================================== if n_elements(infile) eq 0 then begin print, 'Provide input file name' progexit endif dummy = findfile(infile, count=count) if (count eq 0) then begin print,'Input file: '+infile+' cannot be found' progexit endif if n_elements(dn) eq 0 then begin get_ncdf_varnum, ncid, vid progexit endif ;open the netcdf file ncid = ncdf_open(infile,/write) vid = ncdf_varid( ncid, dn) ;see if the array needs to be transposed if (size(d))(0) gt 1 then d = transpose(d) ;write out the data to the netcdf file ncdf_varput, ncid, vid, d ;close the netcdf file ncdf_close, ncid ;======================================== return end