SECOORA / modeling

A place to discuss technical aspects of serving SECOORA model products, via issues and code/config fragments
MIT License
1 stars 0 forks source link

.mat files for FMRC processing #4

Open jbzambon opened 8 years ago

jbzambon commented 8 years ago

Are .mat files able to be read in somehow or should I convert them to NetCDF? The SWAN output is .mat, but much of the important variables (hwave, pwave, etc) are included in our COAWST-ROMS history files as they're on the same grid (WRF has a different grid). So, this is probably low-priority.

rsignell-usgs commented 8 years ago

mat files are not handled by the THREDDS Data Server, so yes, to serve them they would have to be converted to netCDF. I wrote a simple matlab script here while I was at NATO a few years ago https://github.com/rsignell-usgs/cmre-ioos/blob/master/matlab/acoustics/struct2nc.m to convert a matlab structure to a netcdf file, and since matlab files can be loaded into a structure, you could use something like this to convert mat files to netcdf thusly:

fnames = dir('*.mat');
for i=1:length(fnames);
  f = fnames(i).name;
  a = load(f)
  struct2nc(a,[f '.nc'], 'netcdf4_classic', 6)
end

Something like that. I haven't used Matlab in more than a year....