# [ncl-talk] How to correctely draw GPM wthe NCL

Mary Haley haley at ucar.edu
Mon Oct 31 09:02:23 MDT 2016

```Yi Lu,

We have a examples page for precipitation, which includes an example for
GPM data.

http://www.ncl.ucar.edu/Applications/HiResPrc.shtml

See example "gpm_1.ncl".

There were a few issues with your script.

[1] One thing that is important to note about GPM data is that it comes in
as "lon x lat", and in order to plot it with NCL, it needs to be reordered
to "lat x lon".

This is why it's so important to look at your data!  I added these four
lines to help give me a better idea of what your data looks like:

printVarSummary(gpmPre)
printMinMax(gpmPre,0)
print("Your data contains " + num(.not.ismissing(gpmPre)) + " valid
values.")
print("Your data contains " + num(ismissing(gpmPre))      + " missing
values.")

Note: there's a nice function called "stat_dispersion" that's also very

http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml

To reorder the data, you can use the "transpose" function or named
dimensions to reorder:

Using transpose:

gpmPre = transpose(iFile->precipitationCal)

Using named dimensions:

gpmPre = iFile->precipitationCal(lat|:,lon|:)

[2] The contours levels you were choosing were not ideal for this
particular dataset. I changed them to:

res at cnLevelSelectionMode   = "ExplicitLevels"
res at cnLevels               =
(/0.1,0.5,1,2.5,5,10,12,15,20,25,30,35,40,45,50/)   ; "mm/hr"

[3] Your data is regional, so I zoomed in on it using the
mpMinLatF/mpMaxLatF/mpMinLonF/mpMaxLonF resources.

[4] I removed the string processing code for the date because it wasn't
working on the file you gave me.

Please see the attached modified script and PNG image.

--Mary

On Sat, Oct 29, 2016 at 7:32 AM, 易路 <dg1225033 at smail.nju.edu.cn> wrote:

> Hi, all
>
> I planed to draw a contour map of GPM 3IMERG data, but it failed to form
> contours, and showed the following errors. To check this problem, the ascii
> values of the precipitationCal field were exported, but almost of the
> very much!
>
> The script , GPM data and output ascii data are uploaded to the accessory.
> Thanks a lot!
> ;;;;;;;;showed errors;;;;;;;;;;;;;;;;;;;;;;
> (0) check_for_y_lat_coord: Warning: Data either does not contain a valid
> latitude coordinate array or doesn't contain one at all.
> (0) A valid latitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0)     'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
> 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
> (0) check_for_lon_coord: Warning: Data either does not contain a valid
> longitude coordinate array or doesn't contain one at all.
> (0) A valid longitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0)     'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
> fatal:Dimension sizes on right hand side of assignment do not match
> dimension sizes of left hand side
> ;;;;;;;;;;;;;;;error end;;;;;;;;;;;;;;;;;;;;;
>
>
> Yi Lu
>
>
>
>
> 易路
>
> 南大邮件系统/学生/博士生/12级博士生
>
> 南京市汉口路22号
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161031/bfa21085/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: toASCIIandMap_mod.ncl
Type: application/octet-stream
Size: 2040 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161031/bfa21085/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GPM.png
Type: image/png
Size: 175829 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161031/bfa21085/attachment.png
```