How can I load a netcdf file using Meteolab toolbox?
1 次查看(过去 30 天)
显示 更早的评论
I would like load my netcdf file from ModelData directory in MLToolbox by the following way:
dmn=readDomain('c:\Users\Beata\Documents\MATLAB\MLToolbox_R2013\ModelData\CNRM');
date=datenum('01-Jan-1961'):datenum('31-Dec-1990');
path=['c:\Users\Beata\Documents\MATLAB\MLToolbox_R2013\ModelData\CNRM\url.txt'];
[patterns,dmn]=loadGCM(dmn,path,'dates',date,'anHour','Analysis','ds',0);
But I got the following error message:
SWITCH expression must be a scalar or string constant.
Error in loadGCM (line 160)
switch lower(format)
I do not understand what I made wrong. I attached the url, table and domain files. The domain file is originaly of course .cfg file but I attached in .txt file. Could someone help me how can I fix this error?
0 个评论
回答(1 个)
Walter Roberson
2015-8-31
Your url.txt file is not formatted properly. At the moment it starts like
#!Version=2#!Colums=Year, Var, Level, Url#!format=netcdf1961, TP, 0, ./nc/CNRM_1961-1990_pr_power.nc1962, ...
each of the #! needs to start a new line, so it needs to look like
#!Version=2
#!Colums=Year, Var, Level, Url
#!format=netcdf1961, TP, 0, ./nc/CNRM_1961-1990_pr_power.nc1962, TP, 0, ./nc/CNRM_1961-1990_pr_power.nc1963, TP, 0, ....
3 个评论
Walter Roberson
2015-8-31
Try with this url.txt . Note: your 1982 was also missing the final 'c' in the file extension.
Walter Roberson
2015-8-31
You can find a copy of Iberia_NCEP/url.txt at the link. If you look at it, it clearly uses multiple lines, not running everything together in one line.
I suspect you opened the file in Notepad, an old MS Windows application that expects lines to be terminated with carriage return followed by newline, whereas the file is in Unix format which does not use carriage return. With Notepad, everything would have appeared to be on one line.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NetCDF 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!