[pyngl-talk] Updates for using Pyngl

Xiaoni Wang xiaoni.wang at obspm.fr
Thu Oct 27 09:45:52 MDT 2016


Hi Mary,
    Excuse me for one more precision.
    in my  gridused_200307.txt, the center latitude of each grid is in column 2,  and center longitude of each grid is in column 3.  The width of each grid in latitude is 0.25 degree. The width of each grid in longitude is defined in the 4th column. Column 2, 3, 4 are in degrees.
    Please let me know if you need other information.

Best wishes,

Xiaoni


Le 27 oct. 2016 à 13:50, Xiaoni Wang <xiaoni.wang at obspm.fr> a écrit :

> Hi Mary,
>      Following my last email, I also noticed that I have some data over Hudson Bay (which were identified as sea ice), but with my current plotting method, it can not be shown. However there are some data over Caspian Sea (though not expected), and I would like to show them as well. But they are not shown in the figure that I sent to you.
> 
>      I think that perhaps the best way to plot my data (only over land, sea ice and some inland water) is to define cx and cy of each grid, and make interpolation only within the grid (and not outside the grid), and plot those grids which have data (and mask those without data).  I attach here two txt files  that I use for plotting.
> 1)  gridused_200307.txt: defines the grids that my data are in. 256915 lines.
>     1 col:  grid index   (In this file the grid index is not sorted)
>     2 col:  center latitude of this grid
>     3 col:  center longitude of this grid
>     4 col:  width of this grid in longitude (in degrees)
> 
> 2) data_200307.txt: 256915 lines.
>     the data corresponding to the gridused_200307.txt that I would like to plot.
> 
>     I will be looking at your website about how to get a solution for this problem. If you could give me a hand, I would deeply appreciate !!
> 
> Best wishes
> 
> Xiaoni
> 
> 
>      
>    
> Le 27 oct. 2016 à 10:41, Xiaoni Wang <xiaoni.wang at obspm.fr> a écrit :
> 
>> Hi Mary,
>>     Thanks for your response !
>>      I used the configurations in the below, and then the ocean becomes white, and land and land water is shown. But in my data, I also have data over sea-ice, and I need to show them as well. With the current masking, the sea-ice part disappeared, especially near Antarctic (and also some near north pole). Here I attach a new figure isccp_19V.000001.png. It shows no data over sea ice (actually it should have, as in isccp_19V.000001.png.old that I sent to you on Tuesday). Do you have some way to keep the sea ice part ? Thank you in advance !!
>> 
>> Best wishes,
>> 
>> Xiaoni
>> ---------------------------------------------------------------------
>> resources.mpFillOn = True
>> 
>> resources.mpOceanFillColor = "white"
>> 
>> resources.mpLandFillColor = "transparent"
>> 
>> resources.mpInlandWaterFillColor = "transparent"
>> 
>> resources.cnFillDrawOrder = "PreDraw"
>> 
>> <isccp_19V.000001.png>
>> Le 26 oct. 2016 à 19:17, Mary Haley <haley at ucar.edu> a écrit :
>> 
>>> Hi Xiaoni,
>>> 
>>> The image looks to me like the land is getting filled in and covering up the filled contours underneath the map.
>>> 
>>> Please try setting:
>>> 
>>> res.mpLandFillColor = "transparent"
>>> res.mpInlandWaterFillColor = "transparent"
>>> 
>>> 
>>> I've updated the geodesic example at so you can see the structure of the "cx" and "cy" grid:
>>> 
>>> http://www.ncl.ucar.edu/Applications/geodesic.shtml
>>> 
>>> Click on the second image of the first example:
>>> 
>>> http://www.ncl.ucar.edu/Applications/geodesic.shtml
>>> 
>>> Does your ISCCP NetCDF file have any variables on it that look like they might define grid corners or some kind of cell bounds?
>>> 
>>> If you can provide us with a copy of your file, or else the output from the following command,
>>> 
>>> ncl_filedump yourfile.nc
>>> 
>>> then we can have a look to see if there's anything that might help.
>>> 
>>> "yourfile.nc" needs to be replaced with the name of your NetCDF file.
>>> 
>>> ---Mary
>>>  
>>> 
>>> 
>>> On Tue, Oct 25, 2016 at 9:41 AM, Xiaoni Wang <xiaoni.wang at obspm.fr> wrote:
>>> Hi Mary,
>>>      Thank you very much for your prompt response and helpful information !  
>>> 
>>> 1)  in order to plot non-ocean part, I added the following lines in my code.
>>> res.mpFillOn = True
>>> res.mpOceanFillColor = "white"
>>> 
>>> The resulting figure still contains ocean. Then I added 
>>> res.mpFillDrawOrder = "PostDraw"
>>>>>> This time, the ocean part disappeared. But the color scale is greatly changed in the figure. I attach two figures in the below to show their effects. isccp_19V.000001.png with PostDraw added, and isccp_19V.000001.png.old without Postdraw.
>>> 
>>> How can I have the same color as isccp_19V.000001.png.old, but without ocean ?
>>> 
>>> 
>>> 
>>> 2)  I also looked at how to fill the small islands in your examples. There are something that I would like to clarify.
>>>      It seems that , we need the latitude/longitude of grid center, and also information about grid corner, in order to constrain the interpolation.
>>>      In my case, between any two grids, the distance between their center is 0.25 degree in latitude, and varying in longitude. So I have the distance between two grid center in latitude and longitude (in degree).  My question is : how to use them ? The geodesic example just read in  the corner_lat/lon, but are they the latitude/longitude of the 4 corners of a grid ? if so, which corder is the first one, and in which order are they organized ? (In the mpas example, they seem to read in latVertex and lonVertex and they define latvoc/lonvoc. Yet I have the same question….)
>>> 
>>> 
>>> Thank you again !!
>>> 
>>> Best wishes,
>>> 
>>> Xiaoni
>>> 
>>> 
>>>   
>>> 
>>> 
>>> 
>>>> 
>>>> 2) Over small islands, the interpolation method also produced some effects (see large yellow areas on the ocean in figure isccp_19V.00001.png). Again I do not need the ocean around the island, just the results over (small) islands.
>>>> 
>>>> ​This is simply an artifact of having a few values surrounded by a lot of missing values.  In order to plot data like this correctly, you need to have some kind of cell boundary or grid corner information, so the interpolation stays within these bounds.
>>>> 
>>>> If you look at our NCL examples for geodesic and MPAS grids, they set these two special resources:
>>>>   res at sfXCellBounds        = cx
>>>>   res at sfYCellBounds        = cy
>>>> ​which were read off a file, and are usually dimensioned something like N x 4 or N x 3 where N is the number of cell centers, and the 3 or 4 represents the number of vertices of a polygon that surrounds each cell center.
>>>> 
>>>> You can see the NCL code for these examples at:
>>>> 
>>>> http://www.ncl.ucar.edu/Applications/geodesic.shtml
>>>> http://www.ncl.ucar.edu/Applications/mpas.shtml  (see example mpas_cell_3.ncl)
>>> 
>>> 
>>> 
>>> 
>> 
>> _______________________________________________
>> pyngl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
> 
> _______________________________________________
> pyngl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20161027/9d3d97e8/attachment-0001.html 


More information about the pyngl-talk mailing list