[ncl-talk] Problem with contour plot

Mary Haley haley at ucar.edu
Thu Apr 20 11:04:18 MDT 2017


Hi Guilherme,

The "get_areas_of_interest" functio
​n takes a variable name in a shapefile, and returns all values of that
variable, excluding those in the list set by "areas_to_exclude".

​You are actually giving it the full list of values of that variable to
exclude, so it effectively returns missing values.  Hence the error.

I think I understand what you are trying to do.  You want to fill in the
areas outside your shapefile areas in white, to effectively mask them out.

The better way to do this is to find a shapefile that has the areas that
you want filled in white, and simply call gsn_add_shapefile_polygons to
fill these areas in white.

--Mary




On Thu, Apr 20, 2017 at 6:27 AM, Guilherme Martins <jgmsantos at gmail.com>
wrote:

> Dear Mary,
>
> Thank you for all informations.
>
> I'm finishing my script using your informations (shapefiles_21.ncl) but I
> found a problem.
>
> When I run my script, I got that message:
>
> fatal:Subscript out of range, error in subscript #0
> fatal:An error occurred reading features
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 28 in
> file teste.ncl
>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 132 in
> file teste.ncl
>
> I am using the "sigla" variable that has 5 informations (S, SE, N, NE,
> CO), and I can only pass 4 parameters in the "get_areas_of_interest"
> function. If I try to pass 5 parameters (S, SE, N, NE, CO), the script
> returns the above error. The goal is to use the 5 parameters in the
> function.
>
> The script and data can download at:
>
> http://ftp-supercomputacao.inpe.br/public/jose.martins/teste.tar.gz
>
> The shapefile informations (*.png) are in attachment.
>
> Guilherme Martins.
>
>
>
> Em seg, 17 de abr de 2017 às 18:02, Mary Haley <haley at ucar.edu> escreveu:
>
>> Guilherme,
>>
>> Please see examples shapefiles_21.ncl at:
>>
>> http://www.ncl.ucar.edu/Applications/shapefiles.shtml#ex21
>>
>> It explains why you see these "blocky" contours in NCL.
>>
>> Simply put, if you have four points that represent a box at the edge of a
>> domain, and three of them have data one them and one is missing, then NCL
>> will only draw contours in half of the box, because it won't extrapolate to
>> that missing point.
>>
>> The real question is: do you simply want the graphics not to have gaps,
>> or do you actually want there to be data in locations that fall just
>> outside the geographical boundary?  You can do things to force values just
>> outside the geographical boundary, but this depends on how you are masking
>> in the first place.
>>
>> If you are masking based on a shapefile, then see example
>> shapefiles_18.ncl on the same page:
>>
>> http://www.ncl.ucar.edu/Applications/shapefiles.shtml#ex18
>>
>> Note, however, that this mask is now returning values outside the range
>> of interest.
>>
>> If you are simply trying to mask your data *graphically* by some
>> geographical area, then instead of trying to use a mask function, you can
>> draw the full data, and then draw polygons filled in with white in the
>> areas you don't want to see graphically.  That's what example 21 is showing.
>>
>> --Mary
>>
>>
>> On Mon, Apr 17, 2017 at 1:00 PM, Guilherme Martins <jgmsantos at gmail.com>
>> wrote:
>>
>>> Dear users,
>>>
>>> After searching extensively on the NCL website I was not able to find a
>>> solution to my problem. I only want values within the contour of the
>>> continent, but some edges appear in the figure that are stemming from the
>>> mask that I applied and I do not know how to remove this. The figure is
>>> attached for a better view of my problem.
>>>
>>> Best regards,
>>>
>>> Guilherme.
>>> --
>>> ------------------------------------------------------------
>>> ------------------------------------
>>> Instituto Nacional de Pesquisas Espaciais (INPE)
>>> Centro de Previsão de Tempo e Estudos Climáticos (CPTEC)
>>> Divisão de Satélites e Sistemas Ambientais (DSA)
>>> Programa de Monitoramento de Queimadas
>>> Telefone (INPE/CP): +55 12 3186-9205 <+55%2012%203186-9205> || Celular
>>> (TIM): +55 12 98111-4292 <+55%2012%2098111-4292>
>>> E-mail: guilherme.martins at inpe.br || jgmsantos at gmail.com
>>> Skype: guilherme.martins.
>>> Homepage: https://sites.google.com/site/jgmsantos
>>> Currículo Lattes: http://lattes.cnpq.br/5997657584785803
>>> ------------------------------------------------------------
>>> ------------------------------------
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>> --
> ------------------------------------------------------------
> ------------------------------------
> Instituto Nacional de Pesquisas Espaciais (INPE)
> Centro de Previsão de Tempo e Estudos Climáticos (CPTEC)
> Divisão de Satélites e Sistemas Ambientais (DSA)
> Programa de Monitoramento de Queimadas
> Telefone (INPE/CP): +55 12 3186-9205 <+55%2012%203186-9205> || Celular
> (TIM): +55 12 98111-4292 <+55%2012%2098111-4292>
> E-mail: guilherme.martins at inpe.br || jgmsantos at gmail.com
> Skype: guilherme.martins.
> Homepage: https://sites.google.com/site/jgmsantos
> Currículo Lattes: http://lattes.cnpq.br/5997657584785803
> ------------------------------------------------------------
> ------------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170420/e2607eab/attachment.html 


More information about the ncl-talk mailing list