ROMS/TOMS Web Sites & ROMS: NetCDF and Matlab David Robertson and Hernan Arango IMCS, Rutgers University New Brunswick, NJ, USA
Web Statistics 2004 new users: 204 2005 new users: 267 2006 new users: 288 2007 new users: 367 2008 new users: 533 2009 new users: 131
Web Statistics Mar. ‘09 Oct. ‘08 Country Users 1 United States 502 2 China 161 3 6 Australia 70 Spain 5 Japan 64 7 South Korea 62 8 India 61 4 France 60 9 Italy 53 10 11 Brazil 48 Mar. ‘09 Oct. ‘08 Country Users 11 10 Canada 39 12 Germany 32 13 14 Mexico 29 Portugal 28 16 United Kingdom 15 Norway 26 17 Chile 21 18 Taiwan 19 Russia 20 Ireland
Overview Daily Update Email Forum Search Trac Website Forum Posts Trac Ticket Activity (New & Resolved) Revisions Forum Search Trac Website ROMS Documentation Projects WikiROMS Tutorial Movies and Animations
NetCDF-4/HDF5 Capabilities: Allows for multiple unlimited dimensions Data compression Parallel file access Grouping Caveats: Compression cannot be used to write in parallel (PARALLEL_IO) Parallel I/O only in MPI (not shared memory) Separate compilation for every combination of I/0 (parallel v. serial), compiler (PGI, Intel, etc.), and MPI implementation (MPICH2, OpenMPI, etc.) Parallel I/O is slower than serial in ROMS
NetCDF and Matlab® Considerations Interfaces: mexcdf mexnc snctools NetCDF-java Native Matlab (R2008b and newer) NetCDF Version: NetCDF-3 NetCDF-4/HDF5 (must be linked staticly, no shared libraries) NetCDF File Type: Classic (NetCDF-3) HDF5 (NetCDF-4) Misc: File compression (NetCDF-4/HDF5 only) OpenDAP URLs
mexnc Flowchart Matlab® Version mexnc.mex exists? R2008b or newer No R2008a or older Yes mexnc.mex capabilities NetCDF-4/HDF5 NetCDF-3 Native Matlab® NetCDF mexnc.mex
mexnc Flowchart Matlab® Version USE_TMW on? R2008b or newer Yes R2008a or older No mexnc.mex Native Matlab® NetCDF
snctools Flowchart (line colors indicate file type) NetCDF file type mexnc.mex capabilities NetCDF-4/HDF5 NetCDF-4/HDF5 snctools 2.9.4 – 2.9.7 NetCDF-3 NetCDF-3 URL (read only) Java Available? Matlab® Version Error, no method available to read file. No R2008a or older Yes R2008b or newer Native Matlab NetCDF Java ToolsUI.jar mexnc.mex
snctools Flowchart: Reading (grey lines indicate Matlab version line colors indicate file type) Matlab® Version NetCDF file type R2008b or newer snctools 2.9.10 NetCDF-3 R2008a or older NetCDF-4/HDF5 URL USE_JAVA on? Java ToolsUI.jar Yes mexnc.mex No Native Matlab® NetCDF
snctools Flowchart: Writing (grey lines indicate Matlab version line color indicates file type) Matlab Version R2008b or newer NetCDF file type snctools 2.9.10 NetCDF-3 R2008a or older NetCDF-4/HDF5 mexnc.mex Native Matlab NetCDF
ROMS Matlab Pre- and Post-Processing Scripts NetCDF Interface: snctools users should be aware that mexnc, native Matlab NetCDF, and these scripts return arrays with the indices in the order in which the variable is written to the NetCDF file. snctools will give you the array with the indices in the opposite order. Since ROMS is a Fortran code, ROMS arrays in output files are stored in (i, j, k) order. These scripts use mexnc for the backend mexnc.m is required regardless of Matlab version For NetCDF-4/HDF5 capability you need to compile the mexnc mex file yourself mexnc does not use the java ToolsUI.jar file so no OpenDAP NetCDF v4.1 will have build-in OpenDAP capabilities
Dataset Inquiry Functions NetCDF Operator Comparison Dataset Functions NetCDF Native Matlab mexnc snctools nc_create(…); netcdf.create(…); mexnc(‘create’,…); nc_create_empty(…); nc_open(…); netcdf.open(…); mexnc(‘open’,…); ---------- nc_redef(…); netcdf.reDef(…); mexnc(‘redef’,…); nc_endef(…); netcdf.endDef(…); mexnc(‘endef’,…); nc_close(…); netcdf.close(…); mexnc(‘close’,…); nc_sync(…); netcdf.sync(…); mexnc(‘sync’,…); nc_abort(…); netcdf.abort(…); mexnc(‘abort’,…); Dataset Inquiry Functions NetCDF Native Matlab mexnc snctools nc_inq(…); netcdf.inq(…); mexnc(‘inq’,…); nc_info(…); nc_inq_ndims(…); ---------- mexnc(‘inq_ndims’,…); nc_inq_nvars(…); mexnc(‘inq_nvars’,…); nc_inq_natts(…); mexnc(‘inq_natts’,…); nc_inq_unlimdim(…); mexnc(‘inq_unlimdim’,…);
NetCDF Operator Comparison (cont.) Dimension Functions NetCDF Native Matlab mexnc snctools nc_def_dim(…); netcdf.defDim(…); mexnc(‘def_dim’,…); nc_add_dimension(…); nc_inq_dimid(…); netcdf.inqDimID(…); mexnc(‘inq_dimid’,…); ---------- nc_inq_dim(…); netcdf.inqDim(…); mexnc(‘inq_dim’,…); nc_getdiminfo(…); nc_inq_dimname(…); mexnc(‘inq_dimname’,…); nc_inq_dimlen(…); mexnc(‘inq_dimlen’,…); nc_rename_dim(…); netcdf.renameDim(…); mexnc(‘rename_dim’,…); Attribute Functions NetCDF Native Matlab mexnc snctools nc_put_att_*(…); netcdf.putAtt(…); mexnc(‘put_att_*’,…); nc_attput(…); nc_inq_att(…); netcdf.inqAtt(…); mexnc(‘inq_att’,…); nc_info(…); nc_inq_atttype(…); ---------- mexnc(‘inq_atttype’,…); nc_inq_attlen(…); mexnc(‘inq_attlen’,…); nc_inq_attname(…); netcdf.inqAttName(…); mexnc(‘inq_attname’,…); nc_inq_attid(…); netcdf.inqAttID(…); mexnc(‘inq_attid’,…); nc_get_att_*(…); netcdf.getAtt(…); mexnc(‘get_att_*’,…); nc_attget(…); nc_copy_att(…); netcdf.copyAtt(…); mexnc(‘copy_att’,…); nc_rename_att(…); netcdf.renameAtt(…); mexnc(‘rename_att’,…); nc_del_att(…); netcdf.delAtt(…); mexnc(‘del_att’,…);
General Variable Functions NetCDF Operator Comparison (cont.) General Variable Functions NetCDF Native Matlab mexnc snctools nc_def_var(…); netcdf.defVar(…); mexnc(‘def_var’,…); nc_addvar(…); nc_inq_varid(…); netcdf.inqVarID(…); mexnc(‘inq_varid’,…); ---------- nc_inq_var(…); netcdf.inqVar(…); mexnc(‘inq_var’,…); nc_getvarinfo(…); nc_inq_varname(…); mexnc(‘inq_varname’,…); nc_inq_vartype(…); mexnc(‘inq_vartype’,…); nc_inq_vardims(…); mexnc(‘inq_varndims’,…); nc_inq_vardimid(…); mexnc(‘inq_vardimid’,…); nc_inq_varnatts(…); mexnc(‘inq_varnatts’,…); nc_rename_var(…); netcdf.renameVar(…); mexnc(‘rename_var’,…); nc_varrename(…); nc_copy_var(…); -----------
Variable I/O Functions (read) Variable I/O Functions (write) NetCDF Operator Comparison (cont.) Variable I/O Functions (read) NetCDF Native Matlab mexnc snctools nc_get_var_*(…); netcdf.getVar(…); mexnc(‘get_var_*’,…); nc_varget(…); nc_get_var1_*(…); ---------- mexnc(‘get_var1_*’,…); nc_get_vara_*(…); mexnc(‘get_vara_*’,…); nc_get_vars_*(…); mexnc(‘get_vars_*’,…); nc_get_varm_*(…); mexnc(‘get_varm_*’,…); Variable I/O Functions (write) NetCDF Native Matlab mexnc snctools nc_put_var_*(…); netcdf.putVar(…); mexnc(‘put_var_*’,…); nc_varput(…); nc_put_var1_*(…); ---------- mexnc(‘put_var1_*’,…); nc_put_vara_*(…); mexnc(‘put_vara_*’,…); nc_put_vars_*(…); mexnc(‘put_vars_*’,…); nc_put_varm_*(…); mexnc(‘put_varm_*’,…);