Problems with m_proj for specific area of the world
16 次查看(过去 30 天)
显示 更早的评论
Hi,
I have recently switched from python and R to Matlab to use certain features that Matlab offers and Python doesn't. I have been looking at a lot of tutorials and info on my specific problem but cannot solve it.
I basically have Mean Sea Level Pressure data in a NetCDF file stored as lon lat and my data. I need to plot my data over and around Antarctica and also add coastlines using the m_map package but I keep getting error messages such as:
>> Output argument "ncst" (and maybe others) not assigned during call to
"\\filestore\MyFiles\StudentPG1\jb16006\Documents\MATLAB\private\mu_coast.m>mu_coast".
>> Error in m_coast (line 28)
h=mu_coast('default',varargin{:},'tag','m_coast');
Undefined function 'checkellipsoid' for input arguments of type 'double'.
>> Error in resetmstruct (line 29)
checkellipsoid(mstruct.geoid, 'resetmstruct', 'mstruct.geoid');
>> Error in axesm (line 139)
mstruct = resetmstruct(mstruct);
My code at the moment (which plots my data correctly but for the whole word) is as follows:
% Create overal world view of MSLP data
% ---------------------------------------
nc = netcdf.open('MSLP_lagged_15.nc','NC_NOWRITE');
high_15 = netcdf.getVar(nc,15,[0 0],[480 241],'double'); %(file, var number, Dim start, Dim end
lon = netcdf.getVar(nc,0,0,480) % (File, VarID, Start = 0 , End = 480)
lat = netcdf.getVar(nc,1,0,241) % (File, VarID, Start = 0 , End = 241)
for p = 1:480
for q = 1:241
if abs(high_15(p,q)) > 99 % get rid of 99 values if any and replace by NaN
high_15(p,q) = nan;
end
map(q,p) = high_15(p,q);
end
end
pcolor(lon,lat,map)
shading interp
h=colorbar('h')
%set(get(h,'title'),'string','ENSO MSLP Correlation');
hold on
contourf(lon,lat,map)
% ---------------------------------------
When I try to add:
>> m_coast('line');
m_grid('xaxis','bottom');
m_proj('stereographic','lats',90,'lons',45);
to get a focus on Antarctica, my data disappears completely and leaves me with a half white and half green figure of Antarctica's coastline but my data has disappeared completely. Is it an problem of ordering my code so that m_proj comes first before my data? And any idea why I always have error messages when I try to use packages such as m_coast? My Matlab version is MATLAB R2012b x64 and I have already reset my path just in case using:
>> restoredefaultpath;
rehash toolboxcache;
Any help on this would be useful.
Thanks.
0 个评论
采纳的回答
Chad Greene
2017-7-7
pcolorps(lat,lon,map)
antbounds('coast')
I'm not sure how your lat,lon data are formatted, but you might need to do
[Lon,Lat] = meshgrid(lon,lat);
or
[Lat,Lon] = meshgrid(lat,lon);
before calling pcolorps.
0 个评论
更多回答(1 个)
Silver
2018-9-25
I have the same problem @Julien Bodart , did you get the solution ? If you did , pease share it so it helps.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!