[ncl-talk] Reading Ozone data with lat/lon

Dennis Shea shea at ucar.edu
Thu Nov 9 14:27:03 MST 2017


Hi Emma,

THX for sending the text files.

I think there is a mismatch between what you want (spatial plot) and what
you have (a single time series).

O3 Stationlatlon.csv contains station ID, lat, lon for *3 stations*

480290032,29.51509,-98.620166
480290052,29.632058,-98.564936
480290059,29.275381,-98.311692

Ozone SanAn2016.csv  contains a *single time series* [not a complete year].

Date,Ozone
1,0.03
2,0.03
3,0.033
*[snip]*
352,0.022
353,0.038
354,0.03

=============
Also, there is no indication of which station was the source of the time
series.

I created a short script that used some resources for illustration.

Good luck




On Thu, Nov 9, 2017 at 12:13 PM, Guido Cioni <guidocioni at gmail.com> wrote:

> The error is telling you that the problem is in argument (1) of the
> function gsn_csm_contour_map, so data, and that the type is wrong. Quickly
> looking at your file it seems to me that you need to convert data to a
> numeric type (double or float) before plotting it.
> String types of course can not be contoured :)
>
> Have a look here https://www.ncl.ucar.edu/Document/Language/error_messag
> es.shtml.
>
> I think you may want to elaborate the data array a little bit before
> passing it to the contour function. I guess just reading from the text file
> will produce something that is not correctly dimensioned.
>
> Cheers
>
> Il giorno 09 nov 2017, alle ore 18:53, Emma Nelson <enelson23 at wisc.edu>
> ha scritto:
>
> Hi,
>
> I've been trying to plot a file with data from an Ozone station with its
> lat/lon data from another file.  I've been following an example script but
> I keep getting an error that says, "fatal:Argument type mismatch on
> argument (1) of (gsn_csm_contour_map) can not coerce" when I try to
> plot.  Any help would be appreciated!  Here is my script:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> diri = "/Users/EmmaNelson/Desktop/"
> fili = "Ozone SanAn2016.csv"
> data = asciiread(diri+fili, -1, "string")
> header = True
> delim = ","
>
> data2 = asciiread(diri+"O3 Stationlatlon.csv", -1, "string")
> header = True
> delim = ","
>
> sloc = str_get_field(data2, 1, ",")
> lat = tofloat(str_get_field(data2, 2, ",") )
> lon = tofloat(str_get_field(data2, 3, ",") )
>
> pltDir = "/Users/EmmaNelson/Desktop/"
> pltNam = "Ozone"
> pltType = "x11"
>
> wks = gsn_open_wks(pltType,pltDir+pltNam)
> gsn_define_colormap(wks,"WhViBlGrYeOrRe")
>
> res = True
> res at gsnFrame = False
> res at gsnMaximize = True
> res at pmTickMarkDisplayMode = "Always"
>
> res at mpOutlineBoundarySets = "USStates"
>
> res at cnFillOn = True
> res at cnLinesOn = True
> res at cnLineLabelsOn = True
> res at sfXArray = lon
> res at sfYArray = lat
>
> map = gsn_csm_contour_map(wks,data,res)
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> _______________________________________________
> 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/20171109/83c0e5f3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: emma.ncl
Type: application/octet-stream
Size: 2036 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171109/83c0e5f3/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: O3_Stationlatlon.png
Type: image/png
Size: 86094 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171109/83c0e5f3/attachment.png>


More information about the ncl-talk mailing list