From: Li on
I am trying to plot a figure to show the spatial distribution of A in the North Sea. have a three-column data set [Longitude, Latitude, A], which are generated from 'contour'. I also have a digitized two-column data of longitude and latitude to specify the circle outside which, I want my data to be set NaN, so that I do not need to plot data on land.

My question is how to set data outside the irregular circle NaN?

Thanks.
From: Faraz Afzal on
Hey Li,

As I understood you have one data in say Matrix B such as
B = [Longitude, Latitude, A]
and You have another matrix defining circle boundary say that is matrix C
C = [Long, Lat];
And you would liek the data outside this matrix C be NaN

If this is the case you gotta put condition with Matrix C such as:

if Long_Data <= C(:,1)
plot (whatever u want to plot)
elseif Long_Data > C(:,1)
Define here for the data as Nan
end
I hope it helps...

Regards,
Faraz

"Li " <liqingjiang(a)gmail.com> wrote in message <i053cc$m60$1(a)fred.mathworks.com>...
> I am trying to plot a figure to show the spatial distribution of A in the North Sea. have a three-column data set [Longitude, Latitude, A], which are generated from 'contour'. I also have a digitized two-column data of longitude and latitude to specify the circle outside which, I want my data to be set NaN, so that I do not need to plot data on land.
>
> My question is how to set data outside the irregular circle NaN?
>
> Thanks.
From: Li on
Hi Faraz,

Thank you for the reply. Yes, your understanding is correct.

I tried your method. It works great when the situation is simplified (for example just between two lines, but I am afraid it will not work for very complicated irregular circules, like those in a map (with bays, lagoons, peninsulas, etc).

If Matlab has the ability to fill the circle (use the function 'fill' ), there should be a way to get around this.

"Faraz Afzal" <farazafzal(a)gmail.com> wrote in message <i056st$6ar$1(a)fred.mathworks.com>...
> Hey Li,
>
> As I understood you have one data in say Matrix B such as
> B = [Longitude, Latitude, A]
> and You have another matrix defining circle boundary say that is matrix C
> C = [Long, Lat];
> And you would like the data outside this matrix C be NaN
>
> If this is the case you gotta put condition with Matrix C such as:
>
> if Long_Data <= C(:,1)
> plot (whatever u want to plot)
> elseif Long_Data > C(:,1)
> Define here for the data as Nan
> end
> I hope it helps...
>
> Regards,
> Faraz
>
> "Li " <liqingjiang(a)gmail.com> wrote in message <i053cc$m60$1(a)fred.mathworks.com>...
> > I am trying to plot a figure to show the spatial distribution of A in the North Sea. have a three-column data set [Longitude, Latitude, A], which are generated from 'contour'. I also have a digitized two-column data of longitude and latitude to specify the circle outside which, I want my data to be set NaN, so that I do not need to plot data on land.
> >
> > My question is how to set data outside the irregular circle NaN?
> >
> > Thanks.
From: Faraz Afzal on
Hi Li
Hmm....

I see...
So data is like irregular and complex stuff.. !!! Really I think i do need to understand your problem a little more and may be i can help.. For the time being according to my understanding I would suggest to use "intersect" of [Longitude,Latitude] with [long_data, Lat_data] and u will come to know the indices of the points that are of ur interestt..., You can then plot the data for these intersected indices..
may be what i m saying is menaingless, but it is just lack of understanding of the problem..
explain me a little bit more with an example and then we can work out on ur problem..I hope it helps. May be that Intersect if of some use to u..Try that..

Regards,
Faraz



"Li " <liqingjiang(a)gmail.com> wrote in message <i05upu$ln9$1(a)fred.mathworks.com>...
> Hi Faraz,
>
> Thank you for the reply. Yes, your understanding is correct.
>
> I tried your method. It works great when the situation is simplified (for example just between two lines, but I am afraid it will not work for very complicated irregular circules, like those in a map (with bays, lagoons, peninsulas, etc).
>
> If Matlab has the ability to fill the circle (use the function 'fill' ), there should be a way to get around this.
>
> "Faraz Afzal" <farazafzal(a)gmail.com> wrote in message <i056st$6ar$1(a)fred.mathworks.com>...
> > Hey Li,
> >
> > As I understood you have one data in say Matrix B such as
> > B = [Longitude, Latitude, A]
> > and You have another matrix defining circle boundary say that is matrix C
> > C = [Long, Lat];
> > And you would like the data outside this matrix C be NaN
> >
> > If this is the case you gotta put condition with Matrix C such as:
> >
> > if Long_Data <= C(:,1)
> > plot (whatever u want to plot)
> > elseif Long_Data > C(:,1)
> > Define here for the data as Nan
> > end
> > I hope it helps...
> >
> > Regards,
> > Faraz
> >
> > "Li " <liqingjiang(a)gmail.com> wrote in message <i053cc$m60$1(a)fred.mathworks.com>...
> > > I am trying to plot a figure to show the spatial distribution of A in the North Sea. have a three-column data set [Longitude, Latitude, A], which are generated from 'contour'. I also have a digitized two-column data of longitude and latitude to specify the circle outside which, I want my data to be set NaN, so that I do not need to plot data on land.
> > >
> > > My question is how to set data outside the irregular circle NaN?
> > >
> > > Thanks.