📄 netcdf_install.m
字号:
% theDimnames{i}(1) = '';% end% end% set(theDimensions, 'String', theDimnames, 'Value', theDimvalue)% case 'ncvar'% theCount = 0;% for i = 2:length(theVarnames)% theCount = theCount + (theVarnames{i}(1) == '*');% end% for i = 2:length(theVarnames)% theVarPrefix = theVarnames{i}(1);% if theVarPrefix ~= '*' & theCount < length(theVarnames)-1% theVarnames{i} = ['*' theVarnames{i}];% elseif theVarPrefix == '*' & theCount == length(theVarnames)-1% theVarnames{i}(1) = '';% end% end% set(theVariables, 'String', theVarnames, 'Value', theVarvalue)% case 'ncatt'% theCount = 0;% for i = 2:length(theAttnames)% theCount = theCount + (theAttnames{i}(1) == '*');% end% for i = 2:length(theAttnames)% theAttPrefix = theAttnames{i}(1);% if theAttPrefix ~= '*' & theCount < length(theAttnames)-1% theAttnames{i} = ['*' theAttnames{i}];% elseif theAttPrefix == '*' & theCount == length(theAttnames)-1% theAttnames{i}(1) = '';% end% end% set(theAttributes, 'String', theAttnames, 'Value', theAttvalue)% otherwise% end% case {'fillvalue', 'missingvalue', ...% 'addoffset', 'scalefactor', ...% 'units', ...% 'fortranformat', 'cformat', ...% 'epiccode', 'comment', ...% 'genericname', 'longname', 'shortname'}% if isa(theNCItem, 'ncatt')% a = theNCItem;% theLabel = get(gcbo, 'Label');% result = name(a, theLabel);% if strcmp(theVarname, '-')% a = att(self);% else%% v = self{theVarname}; % <== Release 11 Trouble.% v = ncsubsref(self, '{}', {theVarname});% a = att(v);% end% theAttnames = [{'-'} ncnames(a)];% set(theAttributes, 'String', theAttnames);% end% case 'rename'% thePrompt = ['Rename NetCDF ' theConceptname ' "' ...% name(theNCItem) '" To:'];% theName = {name(theNCItem)};% theNewname = inputdlg(thePrompt, ...% 'NetCDF Rename', 1, theName);% theNewname = theNewname{1};% if ~isempty(theNewname) & ~strcmp(theNewname, theName)% name(theNCItem, theNewname)% ncbrefresh(self, theNCItem)% end% set(theProperties, 'String', theProps)% case 'resize'% if isa(theNCItem, 'ncvar') | isa(theNCItem, 'ncdim')% theName = name(theNCItem);% theSize = ncsize(theNCItem);% sz = mat2str(theSize);% thePrompt = ['Resize NetCDF ' theConceptname ' "' ...% theName '" From ' mat2str(theSize) ' To:'];% theNewSize = inputdlg(thePrompt, ...% 'NetCDF Resize', 1, {mat2str(theSize)});% if ~isempty(theNewSize)% theNewSize = eval(['[' theNewSize{1} ']'], '[]');% if isequal(size(theSize), size(theNewSize))% busy% result = resize(theNCItem, theNewSize);% idle% if ~isempty(result)% theNCItem = result;% self.netcdf = parent(theNCItem); % Very important.% ncbevent(self) % Re-catalog.% end% else% warndlg('Requested size is incompatible.', ...% 'NCBrowser Warning')% end% end% end% set(theProperties, 'String', theProps)% case 'lowercase'% name(theNCItem, lower(name(theNCItem)))% ncbrefresh(self, theNCItem)% case 'uppercase'% name(theNCItem, upper(name(theNCItem)))% ncbrefresh(self, theNCItem)% case {'line', 'circles', 'dots', 'degrees', ...% 'contour', 'image', 'listing', ...% 'mesh', 'surf', 'pxline'}% switch ncclass(theNCItem)% case 'ncatt'% theNCItem = parent(theNCItem);% otherwise% end% switch ncclass(theNCItem)% case 'ncvar'% ncbgraph(self, theNCItem, lower(theTag))% otherwise% end% set(theProperties, 'String', theProps)% case 'showgraph'% ncbgraph(self)% otherwise% disp([theEvent ':' theTag])% end% idle(theFigure)%case 'refresh'% ncbrefresh(self, theNCItem)% set(theProperties, 'String', theProps)%otherwise% disp([' ## Unknown event: ' theEvent ':' theTag])%end%%assignin('base', 'ncb', self)%assignin('base', 'nco', theNetCDF)%assignin('base', 'nci', theNCItem)%assignin('base', 'ans', theNCItem)%%idle(theFigure)%%if nargout > 0, theResult = theNCItem; endfclose(fout);disp(' ## Installing: "ncbgraph.m" (text)')fout = fopen('ncbgraph.m', 'w');%function theResult = NCBGraph(self, theNCItem, theKind)%%% NCBGraph -- Graph data from the NetCDF browser.%% NCBGraph(self, theNCItem, 'theKind') plots the data associated%% with theNCItem selected in self, an "ncbrowser" object, using%% 'theKind' of graphical function: 'plot' (default), 'contour',%% 'image', 'list', 'mesh', or 'surf'.% %% Copyright (C) 1997 Dr. Charles R. Denham, ZYDECO.%% All Rights Reserved.%% Disclosure without explicit written consent from the%% copyright owner does not constitute publication.% %% Version of 25-Apr-1997 15:51:05.%% Updated 01-Jan-2000 09:13:08.%%if nargin < 1, help(mfilename), return, end%if nargin < 3, theKind = 'plot'; end%%% Activate the figure.%%theFigure = findobj('Type', 'figure', ...% 'Name', 'NetCDF Browser Graph');% %switch lower(theKind)%case 'listing'%otherwise% if isempty(theFigure)% theFigure = figure('Name', 'NetCDF Browser Graph', 'Visible', 'off');% thePos = get(theFigure, 'Position');% thePos = thePos + thePos([3:4 3:4]) .* [1 1 -2 -2] ./ 10;% set(theFigure, 'Position', thePos, 'Visible', 'on')% end%end%%switch lower(theKind)%case 'listing'%otherwise% figure(theFigure(1)), axes(gca)%end%%if nargin < 2, return, end%%switch ncclass(theNCItem)%case 'ncvar'%case 'ncatt'% theNCItem = parent(theNCItem);% switch ncclass(theNCItem)% case 'ncvar'% otherwise% return% end%otherwise% return%end%%% Plot.%%switch lower(theKind)%case 'line'% result = plot(theNCItem, '-');%case 'circles'% result = plot(theNCItem, 'o');%case 'dots'% result = plot(theNCItem, '.');%case 'degrees' % Very crude at present.% if exist('modplot', 'file') == 2% y = theNCItem(:);% x = (1:length(y)).';% result = feval('modplot', x, y, 360);% xlabel('Index Number')% ylabel(labelsafe(name(theNCItem)))% end%case 'contour'% result = contour(theNCItem);%case 'image'% result = image(theNCItem);%case 'listing'% result = listing(theNCItem);% if nargout > 0, theResult = result; end% return%case 'mesh'% result = mesh(theNCItem);%case 'surf'% result = surf(theNCItem);%case 'pxline'% if exist('pxline', 'file') == 2% h = plot(theNCItem);% x = get(h, 'XData'); y = get(h, 'YData'); c = get(h, 'Color');% delete(h)% if isa(x, 'cell')% temp = zeros(length(x{1}), length(x));% for j = 1:length(x)% temp(:, j) = x{j}(:);% end% x = temp;% end% if isa(y, 'cell')% temp = zeros(length(y{1}), length(y));% for j = 1:length(y)% temp(:, j) = y{j}(:);% end% y = temp;% end% if isa(c, 'cell'), c = c{1}; end% feval('pxline', x(:), y(:), 'Color', c)% end% result = [];%otherwise% result = [];%end%%% Set the title.%%theTitle = name(super(self));%if length(theTitle) > 0% f = find(theTitle == filesep);% if any(f)% theTitle(1:f(length(f))) = '';% end%end%title(labelsafe(theTitle))%%% Make visible and zoomable.%%set([gcf gca], 'Visible', 'on')%%switch lower(theKind)%case 'pxline'% eval('zoomsafe', ';')%otherwise% eval('zoomsafe', ';')%end%%if nargout > 0, theResult = result; endfclose(fout);disp(' ## Installing: "ncbmenu.m" (text)')fout = fopen('ncbmenu.m', 'w');%function theResult = NCBMenu(self)%%% NCBMenu -- Menus for NCBrowser.%% NCBMenu(self) creates the menus for self,%% an NCBrowser.% %% Copyright (C) 1997 Dr. Charles R. Denham, ZYDECO.%% All Rights Reserved.%% Disclosure without explicit written consent from the%% copyright owner does not constitute publication.% %% Version of 21-Apr-1997 11:09:13.%%if nargin < 1, help(mfilename), return, end%%theFigure = self.itSelf;%%% The following uses string-matrices, because%% the Matlab makemenu() function has not been%% upgraded for Matlab-5 cell-arrays.%%theLabels = str2mat( ...% '<NetCDF>', ...% '>About NCBrowser', ...% '>-', ...% '>New', ...% '>>NetCDF...', ...% '>>-', ...% '>>Dimension...', ...% '>>Variable...', ...% '>>Attribute...', ...% '>Open...', ...% '>-', ...% '>Save', ...% '>Save As...', ...% '>-', ...% '>Done', ...% '<Edit>', ...% '>Undo', ...% '>-', ...% '>Cut', ...% '>Copy', ...% '>Paste', ...% '>Delete', ...% '>-', ...% '>Select All', ...% '>-', ...% '>Show Clipboard', ...% '<Rename>', ...% '>Conventions', ...% '>>_FillValue', ...% '>>missing_value', ...% '>>-', ...% '>>scale_factor', ...% '>>add_offset', ...% '>>-', ...% '>>units', ...% '>>-', ...% '>>minimum_value', ...% '>>maximum_value', ...% '>>valid_range', ...% '>>-', ...% '>>C_format', ...% '>>FORTRAN_format', ...% '>>-', ...% '>>title', ...% '>>history', ...% '>>comment', ...% '>>-', ...% '>>description', ...% '>>generic_name', ...% '>>long_name', ...% '>>short_name', ...% '>>-', ...% '>>epic_code', ...% '>-', ...% '>Rename...', ...% '>-', ...% '>Lowercase', ...% '>Uppercase', ...% '>-', ...% '>Resize...', ...% '<Graph>', ...% '>Line', ...% '>Circles', ...% '>Dots', ...% '>-', ...% '>Degrees', ...% '>-', ...% '>Contour', ...% '>Image', ...% '>Mesh', ...% '>Surf', ...% '>-', ...% '>PXLine', ...% '>-', ...% '>Show Graph' ...% );%%theCallback = 'ncbevent(''MenuCallback'')';%theCalls = str2mat( ...% '', ... % NetCDF.% theCallback, ... % About NCBrowser.% '', ...% theCallback, ... % New% theCallback, ... % NetCDF...% '', ...% theCallback, ... % Dimension.% theCallback, ... % Variable.% theCallback, ... % Attribute.% theCallback, ... % Open...% '', ...% theCallback, ... % Save.% theCallback, ... % Save As...% '', ...% theCallback, ... % Done.% '', ... % Edit% '', ... % Undo.% '', ...% '', ... % Cut.% theCallback, ... % Copy.% theCallback, ... % Paste.% '', ... % Clear.% '', ...% theCallback, ... % Select All.% '', ...% theCallback, ... % Show Clipboard.% '', ... % Rename.% '', ... % Conventions.% theCallback, ... % _FillValue.% theCallback, ... % missing_value.% '', ...% theCallback, ... % scale_factor.% theCallback, ... % add_offset.% '', ...% theCallback, ... % units.% '', ...% theCallback, ... % minimum_value.% theCallback, ... % minimum_value.% theCallback, ... % valid_range.% '', ...% theCallback, ... % C_format.% theCallback, ... % FORTRAN_format.% '', ...% theCallback, ... % title.% theCallback, ... % history.% theCallback, ... % comment.% '', ...% theCallback, ... % description.% theCallback, ... % generic_name.% theCallback, ... % short_name.% theCallback, ... % long_name.% '', ...% theCallback, ... % epic_code.% '', ...% theCallback, ... % Rename...% '', ...% theCallback, ... % Lowercase...% theCallback, ... % Uppercase...% '', ...% theCallback, ... % Resize...% '', ... % Graph.% theCallback, ... % Line.% theCallback, ... % Circles.% theCallback, ... % Dots.% ''
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -