comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Why is my code truncating my image dimensions?
items: Re: Why is my code truncating my image dimensions?

Why is my code truncating my image dimensions?
type: item
description: Hi! I am trying to read in two datasets (Landsat and NLDAS) using a .ctl file but my code seems to be truncating the last digit of the Landsat image. I have run through various trials to see why this is happening, with not luck. If someone could take a look below and see if a glaring error pops out I would greatly appreciate it! NOTE*** The Landsat image has dimensions 7931 x 7001. The NLDAS file has dimensions of 224 x 464. The NLDAS data dimensions read in correctly, but the Landsat image prints 793 and 700. In the code below 'nmx' and 'nmy' represent the Landsat input while 'nx' and 'ny' represent the NDLAS input. My original thought was that the data type was set wrong, but I no longer think this to be the case after several test. Also, the truncation occurs when it is first read in not after the FIX operation (if that matters). Any suggestions would be appreciated! Thank you!! Here is the code: OPENR, 1,fname_ctl nmx = 0L & nmy = 0L & nx = 0L & ny = 0L & rad_fname = '' & $ fname0 = '' & fname1 = '' & fname2 = '' & fname3= '' & fname4= '' & fname5= '' & $ fname6= '' & fname7= '' & fname8= '' & fname9= '' & fname10= '' & $ fname11= '' & fname12= '' & fname13= '' & fname14= '' & fname15= '' & $ fname16= '' & fname17= '' & fname18= '' & fname19= '' & fname20= '' & $ fname21= '' & fname22= '' & fname23='' & fname50= '' ; Read in each line WHILE (~ EOF(1)) DO BEGIN READF,1,$ FORMAT = '(I3,3(/,I3),25(/,A100),/,A100)',nmx,nmy,nx,ny,rad_fname, fname0, $ fname1,fname2,fname3,fname4,fname5,fname6,fname7,fname8,fnam e9,fname10,$ fname11,fname12,fname13,fname14,fname15,fname16,fname17,fnam e18,fname19,fname20,$ fname21,fname22,fname23,fname50 PRINT,$ FORMAT = '(I3,3(/,I3),25(/,A100),/,A100)',nmx,nmy,nx,ny,rad_fname, fname0, $ fname1,fname2,fname3,fname4,fname5,fname6,fname7,fname8,fnam e9,fname10,$ fname11,fname12,fname13,fname14,fname15,fname16,fname17,fnam e18,fname19,fname20,$ fname21,fname22,fname23,fname50 ENDWHILE ; Convert the read in values to proper type nx = FIX(n…
creator: adhdunn
date: 2012-08-13T15:33:51-00:00

Re: Why is my code truncating my image dimensions?
type: item
description: Hi Helder, Thanks for all the help!! Your explanation of the Format components was great and will hopefully guide me in the future! Yes working with this code has been a nightmare. There are 5 programs that all run together to read in the NLDAS files (which come in GRIB format) and the Landsat image. It is always hard to try and take an established program, or set of programs, and adapt it to your own needs. This is what I have been working on and I find that there are often steps I would have done differently, unfortunately I am still quite a newbie with IDL and so I don't yet have the luxury to re-invent the wheel per-se. Thanks also for the alternative way to read in the data, I am sure it will make this process much easier. Best to you and Thanks Again!! Allisyn On Monday, August 13, 2012 4:56:18 PM UTC-4, Helder wrote: > On Monday, August 13, 2012 8:52:00 PM UTC+2, adh...@gmail.com wrote: > >> Yes, I agree it is the format line. After I changed the text to read as you suggested, the first program worked great :) I am simply not accustomed to working with the format command and therefore I am having a hard time figuring out the context of all the values. I understand that 'F' is used for float, 'I' for integer, 'A' for characters. I also understand that if you have 'A100' then your file name (or whatever) can not exceed 100 characters. > >> > >> However I am struggling with other inputs like: > >> > >> > >> > >> '/'-- does this mean a new line or return? > >> > >> ','-- does this mean the next command? > >> > >> '()'-- why would you have some values in additional parenthesis while others not > >> > >> 'F6.3'-- what is the relevance of the 6.3. I see (below) that there are 6 values for the number, but why the .3? > >> > >> 'A100,5'-- what is the relevance of ,5? > >> > >> > >> > >> Anyways this is the header information for the .ctl file that you requested: > >> > >> 7931 > >> > >> 7001 > >> > >> 224 > >> > >> 464 > >> > >> 25.063 > >> > >> -124.938 > >> > >> E:\…
creator: adhdunn
date: 2012-08-13T23:49:03-00:00

Re: Why is my code truncating my image dimensions?
type: item
description: On Tuesday, August 14, 2012 1:49:03 AM UTC+2, adh...@gmail.com wrote: > Hi Helder, > > > > Thanks for all the help!! Your explanation of the Format components was great and will hopefully guide me in the future! > > > > Yes working with this code has been a nightmare. There are 5 programs that all run together to read in the NLDAS files (which come in GRIB format) and the Landsat image. It is always hard to try and take an established program, or set of programs, and adapt it to your own needs. This is what I have been working on and I find that there are often steps I would have done differently, unfortunately I am still quite a newbie with IDL and so I don't yet have the luxury to re-invent the wheel per-se. > > > > Thanks also for the alternative way to read in the data, I am sure it will make this process much easier. > > > > Best to you and Thanks Again!! > > Allisyn > > > > > > On Monday, August 13, 2012 4:56:18 PM UTC-4, Helder wrote: > >> On Monday, August 13, 2012 8:52:00 PM UTC+2, adh...@gmail.com wrote: > >> > >>> Yes, I agree it is the format line. After I changed the text to read as you suggested, the first program worked great :) I am simply not accustomed to working with the format command and therefore I am having a hard time figuring out the context of all the values. I understand that 'F' is used for float, 'I' for integer, 'A' for characters. I also understand that if you have 'A100' then your file name (or whatever) can not exceed 100 characters. > >> > >>> > >> > >>> However I am struggling with other inputs like: > >> > >>> > >> > >>> > >> > >>> > >> > >>> '/'-- does this mean a new line or return? > >> > >>> > >> > >>> ','-- does this mean the next command? > >> > >>> > >> > >>> '()'-- why would you have some values in additional parenthesis while others not > >> > >>> > >> > >>> 'F6.3'-- what is the relevance of the 6.3. I see (below) that there are 6 values for the number, but why the .3? > >> > >>> > >> > >>> 'A100,5'-- what is the relevanc…
creator: Helder Marchetto
date: 2012-08-14T09:30:43-00:00

Re: Why is my code truncating my image dimensions?
type: item
description: Yes I can see how formatting can work very well in your case. Hopefully I can crack this darn set of programs today and try to move forward. Of course I will most likely be moving on to another code and another set of problems ;) I am also surrounded by a lot of people with a wealth of knowledge, unfortunately that knowledge is just not IDL based. Best of luck to you and thanks again for your help! You will probably see my name on this site a bit more in the future. Cheers! Allisyn On Monday, August 13, 2012 11:33:51 AM UTC-4, adh...@gmail.com wrote: > Hi! > > > > I am trying to read in two datasets (Landsat and NLDAS) using a .ctl file but my code seems to be truncating the last digit of the Landsat image. I have run through various trials to see why this is happening, with not luck. If someone could take a look below and see if a glaring error pops out I would greatly appreciate it! > > > > NOTE*** The Landsat image has dimensions 7931 x 7001. The NLDAS file has dimensions of 224 x 464. The NLDAS data dimensions read in correctly, but the Landsat image prints 793 and 700. In the code below 'nmx' and 'nmy' represent the Landsat input while 'nx' and 'ny' represent the NDLAS input. My original thought was that the data type was set wrong, but I no longer think this to be the case after several test. Also, the truncation occurs when it is first read in not after the FIX operation (if that matters). > > > > Any suggestions would be appreciated! Thank you!! > > > > Here is the code: > > > > OPENR, 1,fname_ctl > > > > nmx = 0L & nmy = 0L & nx = 0L & ny = 0L & rad_fname = '' & $ > > fname0 = '' & fname1 = '' & fname2 = '' & fname3= '' & fname4= '' & fname5= '' & $ fname6= '' & fname7= '' & fname8= '' & fname9= '' & fname10= '' & $ > > fname11= '' & fname12= '' & fname13= '' & fname14= '' & fname15= '' & $ > > fname16= '' & fname17= '' & fname18= '' & fname19= '' & fname20= '' & $ > > fname21= '' & fname22= '' & fname23='' & fname50= '' > > > > ; Read in each line > > > > …
creator: adhdunn
date: 2012-08-14T11:29:39-00:00