| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| So, I'm really confused. The current code I am building repeatedly uses the line: cld = [[cld], [startCld(flist[i], pInd, lat[pInd], lon[pInd], date[pInd], time[pInd])]] where "cld" is an array of named structures and "startCld" is a function that creates a named structure. In both cases, the array is named "cirrusStruct." The concatenation above works 70 times in a row, however, on the 71st time it fails and gives the following error: % Unable to concatenate variables because the dimensions do not agree: <STRUCT Array[1]>. % Execution halted at: FINDTHINCIRRUS 467 /home/jsolbrig/geoprof- lidar/findThinCirrus.pro % $MAIN$ Now, after the error has occurred, if I use the "startCld" routine from command line to create a structure "a," then type "help, cld, a, / structure" they appear to be exactly alike, however still will not concatenate. IDL> help, cld, a CLD STRUCT = -> CIRRUSSTRUCT Array[70] A STRUCT = -> CIRRUSSTRUCT Array[1] IDL> help, cld, a, /str ;Help info for "help, cld, /str" ** Structure CIRRUSSTRUCT, 12 tags, length=112, data length=108: STARTDATE LONG 20060701 STARTTIME DOUBLE 0.016666668 STARTFILE STRING '/sn1/jsolbrig/GEOPROF-Lidar/ jul06/2006182000103_00927_CS_2B-GEOPROF- LIDAR_GRANULE_P1_R04_E00.hdf.zip' ENDFILE STRING '/sn1/jsolbrig/GEOPROF-Lidar/ jul06/2006182000103_00927_CS_2B-GEOPROF- LIDAR_GRANULE_P1_R04_E00.hdf.zip' STARTPROF DOUBLE 151.00000 ENDPROF DOUBLE 151.00000 STARTLAT DOUBLE -1.4628147 ENDLAT DOUBLE -1.4628147 STARTLON DOUBLE 25.093336 ENDLON DOUBLE 25.093336 MAXTHK DOUBLE 0.0000000 MINTHK DOUBLE 0.0000000 ;Help info for "help, a, /str" ** Structure CIRRUSSTRUCT, 12 tags, length=112, data length=108: STARTDATE LONG 20060701 STARTTIME DOUBLE 9.8166666 STARTFILE STRING '/sn1/jsolbrig/GEOPROF-Lidar/ jul06/2006182081529_00932_CS_2B-GEOPROF- LIDAR_GRANULE_P1_R04_E00.hdf.zip' ENDFILE STRING '' STARTPROF DOUBLE 35189.000 ENDPROF DOUBLE 0.0000000 STARTLAT DOUBLE 18.281832 ENDLAT DOUBLE 0.0000000 STARTLON DOUBLE -118.93538 ENDLON DOUBLE 0.0000000 MAXTHK DOUBLE 0.0000000 MINTHK DOUBLE 0.0000000 ;Concatenating arrays of structures DL> cld = [[cld], [a]] % Unable to concatenate variables because the dimensions do not agree: A. % Execution halted at: FINDTHINCIRRUS 467 /home/jsolbrig/geoprof- lidar/findThinCirrus.pro % $MAIN$ After what I've said above, there are still a couple more points that should be made. 1) The routine I am working on has previously concatenated up to 4,000 structures into the same array. 2) One of the 70 previous structures is coming directly from the same portion of the code that is failing. endif else if true1[pInd] eq 0 and true2[pInd] eq 1 then begin ;continuing previous cloud prevBase = layBase[cirrusLays[1], pInd] prevTop = layTop[cirrusLays[1], pInd] ;starting second cloud cldMax = n_elements(cld) cld = [[cld], [startCld(flist[i], pInd, lat[pInd], lon[pInd], date[pInd], time[pInd])]] ;FAILS HERE prevBase = [prevBase, layBase[cirrusLays[0], pInd]] prevTop = [prevTop, layTop[cirrusLays[0], pInd]] twoCldStep[pInd] = 3 If anyone has a suggestion as to how to fix this problem, I would greatly appreciate your input. |
|
#2
| |||
| |||
| I have solved my problem, but am still unsure why my method worked many, many times, then decided to quit working. I would really like to know so I don't so either I don't do something dumb again, or I can avoid a subtle little problem I haven't thought of yet. Thanks |
|
#3
| |||
| |||
| On Aug 29, 1:26 am, "J. Solbrig" <JSolb...@gmail.com> wrote: > I have solved my problem, but am still unsure why my method worked > many, many times, then decided to quit working. I would really like > to know so I don't so either I don't do something dumb again, or I can > avoid a subtle little problem I haven't thought of yet. > > Thanks Hi, I think the issue may be a little clouded by the fact that your example is with named structures. It really isn't an issue about structures but about arrays of any type. Here's a simplifed example of what you tried above... SeaDAS> x = {XSTRUCT, A: 0, B: 'boo'} SeaDAS> a = REPLICATE(x, 70) SeaDAS> b = [[a],[x]] % Unable to concatenate variables because the dimensions do not agree: X. % Execution halted at: $MAIN$ SeaDAS> help, [a,x] <Expression> STRUCT = -> XSTRUCT Array[71] SeaDAS> help, [[a],[a]] <Expression> STRUCT = -> XSTRUCT Array[70, 2] The form of concatenation that looks like [[a],[b]] tries to create an new array with a second dimension. The form of concatenation that looks like [a,b] simply appends b to a (which what I think you want). Cheers, Ben |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.