pro mknc_lbc ; ; Read text files w/ lbc for vtgcm lower boundary of t,u,v,z, ; and write a netcdf file for import to vtgcm ; ;-rw-r--r-- 1 foster tgcm 27648 Nov 12 13:08 GeoHtout.txt ;-rw-r--r-- 1 foster tgcm 25056 Nov 12 13:08 Meriout.txt ;-rw-r--r-- 1 foster tgcm 22464 Nov 12 13:08 Tempout.txt ;-rw-r--r-- 1 foster tgcm 24072 Nov 12 13:08 Zonalout.new.txt ; nlon = 72 nlat = 36 tfile = 'Tempout.txt' ufile = 'Zonalout.new.txt' vfile = 'Meriout.txt' zfile = 'GeoHtout.txt' t_lbc = fltarr(nlon,nlat) u_lbc = fltarr(nlon,nlat) v_lbc = fltarr(nlon,nlat) z_lbc = fltarr(nlon,nlat) ; ; Read temperature: ; openr,lu,tfile,/get_lun print,'Opened tfile ',tfile,' lu=',lu readf,lu,t_lbc print,'t_lbc min,max=',min(t_lbc),max(t_lbc) free_lun,lu ; ; Read zonal wind: ; openr,lu,ufile,/get_lun print,'Opened ufile ',ufile,' lu=',lu readf,lu,u_lbc print,'u_lbc min,max=',min(u_lbc),max(u_lbc) free_lun,lu ; ; Read meridional wind: ; openr,lu,vfile,/get_lun print,'Opened vfile ',vfile,' lu=',lu readf,lu,v_lbc print,'v_lbc min,max=',min(v_lbc),max(v_lbc) free_lun,lu ; ; Read geopotential: ; openr,lu,zfile,/get_lun print,'Opened zfile ',zfile,' lu=',lu readf,lu,z_lbc print,'z_lbc min,max=',min(z_lbc),max(z_lbc) free_lun,lu ; ; Create new netcdf dataset: ; ncfile_name = 'oxvgcm_lbc.nc' ; Data is from Oxford Venus GCM ncid = ncdf_create(ncfile_name,/clobber) print,'Created netcdf file ',ncfile_name,' ncid=',ncid ; ; Define dimensions: ; id_unlim = ncdf_dimdef(ncid,'time',/unlimited) id_nlon = ncdf_dimdef(ncid,'lon',nlon) id_nlat = ncdf_dimdef(ncid,'lat',nlat) ; ; Define coordinate and data variables: ; idv_time = ncdf_vardef(ncid,'time',id_unlim) idv_lon = ncdf_vardef(ncid,'lon' ,id_nlon) idv_lat = ncdf_vardef(ncid,'lat' ,id_nlat) idv_t = ncdf_vardef(ncid,'t_lbc',[id_nlon,id_nlat,id_unlim]) idv_u = ncdf_vardef(ncid,'u_lbc',[id_nlon,id_nlat,id_unlim]) idv_v = ncdf_vardef(ncid,'v_lbc',[id_nlon,id_nlat,id_unlim]) idv_z = ncdf_vardef(ncid,'z_lbc',[id_nlon,id_nlat,id_unlim]) ; ; Take out of define mode: ; ncdf_control,ncid,/endef ; ; Write coordinate variables: ; ; Time coordinate: time = 1. ; arbitrary for now ncdf_varput,ncid,idv_time,time ; ; Longitude coordinates: ; lon = fltarr(nlon) dlon = 5.0 for i=0,nlon-1 do begin lon[i] = -180.+i*dlon endfor print,'lon=' & print,lon ncdf_varput,ncid,idv_lon,lon ; ; Latitude coordinates: ; lat = fltarr(nlat) dlat = 5.0 for j=0,nlat-1 do begin lat[j] = -87.5+j*dlat endfor print,'lat=' & print,lat ncdf_varput,ncid,idv_lat,lat ; ; Write data variables: ; ncdf_varput,ncid,idv_t,t_lbc ncdf_varput,ncid,idv_u,u_lbc ncdf_varput,ncid,idv_v,v_lbc ncdf_varput,ncid,idv_z,z_lbc ncdf_close,ncid end