How can I load a netcdf file using Meteolab toolbox?

조회 수: 2 (최근 30일)
Szabó-Takács Beáta
Szabó-Takács Beáta 2015년 8월 31일
댓글: Walter Roberson 2015년 8월 31일
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?

답변 (1개)

Walter Roberson
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
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
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 CenterFile Exchange에서 NetCDF에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by