[ncl-talk] Error trying to produce 2line graph

Mary Haley haley at ucar.edu
Fri Jan 29 10:28:11 MST 2016


Hi Steven,

Sorry we didn't get back to you sooner.

The problem is that you are trying to use the dimension sizes of the full
"var2" variable to create the "data" array:

  data = new((/2,dimsizes(var2)/),float)

var2 is a 2D array of size (/180,359/), so you are effectively trying to do
this:

  data = new((/2,(/180,359/)/),float)

NCL doesn't allow for this kind of nested (/ and /) in the "new" statement;
this is what's causing the weird "literal array" error.

I think you meant to just include the rightmost dimension of var2:

  data = new((/2,dimsizes(var2(0,:))/),float)

--Mary


On Wed, Jan 27, 2016 at 1:54 PM, BLIUJUS, STEVEN D CTR USAF AFMC
AFLCMC/HBAW-OL <steven.bliujus.3.ctr at us.af.mil> wrote:

> I am trying to produce a graph with 2 different variables on a single plot.
> I have AOD from two different sources (MODIS and Model output). They both
> have the same dimensions, both are 2 dimensions. I get the same thing when
> I
> print dimsizes for both variables.
> (0)     180
> (1)     359
>
> Unfortunately the FIM_Chem file is too large to attach.
>
> However when I run the code that was based off of xy_2.ncl I get the
> following error:
>
> fatal:_NclBuildArray: each element of a literal array must have the same
> dimension sizes, at least one item doesn't
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 49 in file
> Scatterplot.ncl
>
> This is my code:
>
>
> load "/home/bliujuss/ncl/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "/home/bliujuss/ncl/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> load "/home/bliujuss/ncl/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "/home/bliujuss/ncl/lib/ncarg/nclscripts/csm/shea_util.ncl"
> ;************************************************
> begin
> ;************************************************
> ; Generate some random data
> ;************************************************
>
> a =
>
> addfile("/home/bliujuss/Plots/g4.timeAvgMap.MOD08_M3_051_Optical_Depth_Land_
> And_Ocean_Mean_Mean.20150701-20150731.180W_90S_180E_90N.nc","r")
> b = addfile("/home/bliujuss/Plots/FIM_Chem_2014112418.nc","r")
>
> var1 = a->MOD08_M3_051_Optical_Depth_Land_And_Ocean_Mean_Mean
> var2 = b->VAR_147_GDS0_EATM
> var1_reorder = var1(lat|:,lon|0:358)
> ;printVarSummary(var1_reorder)
> ;printVarSummary(var2)
>
> ;print(var2(120,199))
> ;print(var1_reorder(120,199))
>
> bias = var1_reorder - var2
> wks   = gsn_open_wks ("x11","xy")            ; open workstation
> res                   = True                     ; plot mods desired
> res at gsnMaximize       = True                     ; maximize plot
> res at tiMainString      = "Two curve XY plot"
> res at xyLineThickness  = (/1.0,2.0/)
> res at xyLineColors   = (/"blue","red"/)      ; add title
> res at xyMarkLineMode    = "MarkLines"                ; choose to use markers
> res at xyMarkers         =  (/1,2/)                      ; choose type of
> marker
>
> print(dimsizes(var1_reorder))
> print(dimsizes(var2))
> data = new((/2,dimsizes(var2)/),float)
> data(0,:) = var1_reorder(90,:)
> data(1,:) = var2(90,:)
>
> plot  = gsn_csm_y (wks,data,res)                    ; create plot
>
> end
>
>
> I am using version 6.1.2
> I am using gcc version 4.1.2
> I'm using x86_64 GNU/Linux
> I have attached the two data files.
>
> Steven Bliujus, Contractor
> SEMS/16WS WXE
> 557th Weather Wing
> DNS: 232-7151
>
>
>
> _______________________________________________
> 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/20160129/c2c0c29b/attachment.html 


More information about the ncl-talk mailing list