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

Geomask error for polygons #21

Open
ostriz2 opened this issue Dec 3, 2023 · 0 comments
Open

Geomask error for polygons #21

ostriz2 opened this issue Dec 3, 2023 · 0 comments

Comments

@ostriz2
Copy link

ostriz2 commented Dec 3, 2023

Hi,
I'm new to CDT and new to GitHub. I am trying to write my thesis on climate change with the help of Matlab and CDT…
And I found out that the geomask does not work well when entering multiple countries = polygons (at least according to the instructions).

Therefore, instead of the part in the geomask.m function:

indv = lonv > 180;
lonv(indv) = lonv(indv) - 360;

I suggest using:

% The following part of the code (lonv correction) was made by Tomáš Poláček
% Check if lonv is of type cell
if iscell(lonv)
    % Iterate over individual rows
    for i = 1:numel(lonv)
        % If the given line contains double data
        if isnumeric(lonv{i})
            indv = lonv{i} > 180;
            lonv{i}(indv) = lonv{i}(indv) - 360;
        end
    end
else
    % If lonv is not of cell type, it is a different variable type,
    % we perform the operation on the entire lonv (if it is of type double)
    if isnumeric(lonv)
        indv = lonv > 180;
        lonv(indv) = lonv(indv) - 360;
    end
end

There is also inaccuracy in CDT help (geomask):
% For this sample 1 degree resolution grid:
[Lat,Lon] = geogrid;

(geogrid is not defined function)

So maybe it will be better to use something like:
[Lon,Lat] = meshgrid(lon, lat);

Thank you in advance for your response and possible correction of my statement.

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

1 participant