Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.mat files for FMRC processing #4

Open
jbzambon opened this issue Sep 1, 2016 · 1 comment
Open

.mat files for FMRC processing #4

jbzambon opened this issue Sep 1, 2016 · 1 comment

Comments

@jbzambon
Copy link
Contributor

jbzambon commented Sep 1, 2016

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
Copy link
Collaborator

rsignell-usgs commented Sep 5, 2016

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....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants