From asphilli at ucar.edu Mon Mar 16 10:03:12 2026 From: asphilli at ucar.edu (Adam Phillips) Date: Mon, 16 Mar 2026 10:03:12 -0600 Subject: [ncl-talk] about a 2D array den[lon,lat] In-Reply-To: References: Message-ID: Hi Zhuxiao, Can you run the following and report back on the returned output? printVarSummary(den) plot = gsn_csm_contour_map_ce(wks,den(lat|:,lon|:),res) That syntax looks good to me assuming den is a 2-dimensional array with dimension names lat and lon. This syntax will likely throw an error: den_md = wgt_areaave_Wrap(den(:,lat|:,lon|:),cost(:),1.0,0) This is due to the fact that you are coordinate subscripting (with the lat|:,lon|: syntax) with your 1st and 2nd dimensions but you are not referring to the name of the 0th dimension. I believe what you would need to do is something like this: den_md = wgt_areaave_Wrap(den(time|:,lat|:,lon|:),cost(:),1.0,0) Note that you need to specify time|: even though you are not reordering the time dimension. Best, Adam On Sat, Mar 14, 2026 at 5:05?PM Zhuxiao Li - NOAA Affiliate < zhuxiao.li at noaa.gov> wrote: > Hi Adam, > How are you? > I have met a problem to deal with a 2D array, as den[lon, lat], > den!0 = "lon" > den&lon = lon > den!1 = "lat" > den&lat = lat > Note that the latitude is the fastest changing dimension. > I got a problem when I do > plot = gsn_csm_contour_map_ce(wks,den(lat|:,lon|:),res) > or den_md = wgt_areaave_Wrap(den(:,lat|:,lon|:),cost(:),1.0,0) > Got the following error message > fatal:Error in subscript, normal subscripting is being used, make sure > named subscripting has not been used > fatal:Error in subscript, normal subscripting is being used, make sure > named subscripting has not been used > fatal:syntax error: function gsn_csm_contour_map_ce expects 3 arguments, > got 1 > I am using NCL6.6.2 > Could you please tell me the solution? > Thanks! > Zhuxiao > > > > > -- > Dr. Zhuxiao Li > NOAA/NWS/NCEP/SWPC > 325 Broadway, > Boulder, Colorado 80305 > 303-497-4649 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: