[Thread Prev][Thread Next][Index]

Re: [ferret_users] List command lists data from down to up but I want it from up to down



Hi,
Yes, Ryo, I think that the question is about the ordering in listings for a longitude axis. 

I always like to make a simple example so I can see what's happening.  If I understand the question correctly, Sanaz, you want the listing to be from north to south for each time step.


!  Define a simple variable in x-y-t

yes? define axis/x=120:124:1/units=degrees_longitude xaxis
yes? define axis/y=2:6:2/units=degrees_latitude yaxis
yes? define axis/t=1-may-2023:3-may-2023:1/units=days taxis
yes? let xytvar = 100*L[gt=taxis] + 10*j[gy=yaxis] + i[gx=xaxis]

! The default list ordering lists the data at latitudes from north
! to south

yes? list xytvar
             VARIABLE : 100*L[GT=TAXIS] + 10*J[GY=YAXIS] + I[GX=XAXIS]
             SUBSET   : 5 by 3 by 3 points (LONGITUDE-LATITUDE-TIME)
            120E   121E   122E   123E   124E   
              1      2      3      4      5
 ---- L:1 T:   01-MAY-2023 00:00
 6N   / 3:  131.0  132.0  133.0  134.0  135.0
 4N   / 2:  121.0  122.0  123.0  124.0  125.0
 2N   / 1:  111.0  112.0  113.0  114.0  115.0
 ---- L:2 T:   02-MAY-2023 00:00
 6N   / 3:  231.0  232.0  233.0  234.0  235.0
 4N   / 2:  221.0  222.0  223.0  224.0  225.0
 2N   / 1:  211.0  212.0  213.0  214.0  215.0
 ---- L:3 T:   03-MAY-2023 00:00
 6N   / 3:  331.0  332.0  333.0  334.0  335.0
 4N   / 2:  321.0  322.0  323.0  324.0  325.0
 2N   / 1:  311.0  312.0  313.0  314.0  315.0


! When listed with a format statement to remove the extra text in the listing, the ordering
! each time is in the reverse order, from south to north

yes? list/nohead/format=(5f8.2) xytvar
  111.00  112.00  113.00  114.00  115.00
  121.00  122.00  123.00  124.00  125.00
  131.00  132.00  133.00  134.00  135.00
  211.00  212.00  213.00  214.00  215.00
  221.00  222.00  223.00  224.00  225.00
  231.00  232.00  233.00  234.00  235.00
  311.00  312.00  313.00  314.00  315.00
  321.00  322.00  323.00  324.00  325.00
  331.00  332.00  333.00  334.00  335.00

! The above is how the default listing would look if the Y axis were not
! a longitude axis. Remove the latitude definition and show the listing.

yes? set axis/units=none `xytvar,return=yaxis`
 !-> set axis/units=none YAXIS
           *** NOTE: Units  not recognized: none
           *** NOTE: They will not be convertible:
yes? list xytvar
             VARIABLE : 100*L[GT=TAXIS] + 10*J[GY=YAXIS] + I[GX=XAXIS]
             SUBSET   : 5 by 3 by 3 points (LONGITUDE-Y (none)-TIME)
           120E   121E   122E   123E   124E   
             1      2      3      4      5
 ---- L:1 T:   01-MAY-2023 00:00
 2   / 1:  111.0  112.0  113.0  114.0  115.0
 4   / 2:  121.0  122.0  123.0  124.0  125.0
 6   / 3:  131.0  132.0  133.0  134.0  135.0
 ---- L:2 T:   02-MAY-2023 00:00
 2   / 1:  211.0  212.0  213.0  214.0  215.0
 4   / 2:  221.0  222.0  223.0  224.0  225.0
 6   / 3:  231.0  232.0  233.0  234.0  235.0
 ---- L:3 T:   03-MAY-2023 00:00
 2   / 1:  311.0  312.0  313.0  314.0  315.0
 4   / 2:  321.0  322.0  323.0  324.0  325.0
 6   / 3:  331.0  332.0  333.0  334.0  335.0

! Here are loops which will list data at each time step from north to south.
! (This output would be the same if the y-axis has latitude units.)

yes? cancel mode verify  ! remove the echo-ing of the commands

yes? repeat/L=1:`xytvar,return=Lsize` (\
...? repeat/J=`xytvar,return=jsize`:1:-1 (\
...? list/nohead/order=x/format=(5f8.2) xytvar))
  131.00  132.00  133.00  134.00  135.00
  121.00  122.00  123.00  124.00  125.00
  111.00  112.00  113.00  114.00  115.00
  231.00  232.00  233.00  234.00  235.00
  221.00  222.00  223.00  224.00  225.00
  211.00  212.00  213.00  214.00  215.00
  331.00  332.00  333.00  334.00  335.00
  321.00  322.00  323.00  324.00  325.00
  311.00  312.00  313.00  314.00  315.00


Ansley

On 9/21/2023 9:03 PM, Ryo Furue wrote:
Dear Ansley and Sanaz,

I thought Sanaz may be asking how to change the order of listing in the J direction (meridional direction).

With

lis/format=(${LONPOINTS}(f10.2)) 

you are listing the values at a single latitude on one text line.  (${LONPOINTS} is a shell syntax, I suppose. See below.). So, in the text file, you get a 2D listing with latitude (J) along the vertical axis and longitude (I) along the horizontal axis.


 I do not understand your use of M and L in the loop
structure you are showing.

I guess that was a pseudo code, just to illustrate the problem, using the shell (bash) syntax:  On bash, 

for i in {1..10}; do
   echo $i
done

will print 1 to 10.

Ryo


 
  If you are using repeat loops, you will need
to use L for time, J for latitude, and I for longitude.  One possibility
might be to use the LIST/PRECISION qualifier instead of using /FORMAT=f10.2)


On 9/20/2023 2:04 PM, Mosayebi, Sanaz wrote:
> Hello,
>
> I have a netcdf file and I am trying to convert it to a text file.
>
> Here is the information of my input file:
>
> TIMESTEPS=2920
> LONPOINTS=537
> LATPOINTS=225
> INPUTVARS=(PSFC U10 V10)
>
> And I am trying this:
>
> for m in {1..2929}; do
>     for l in {1..1}; do
>         for INPUTVAR in ${INPUTVARS[@]}; do
>
> let tmp = if ${INPUTVAR}[l=${l},m=${m}] eq (-9e+33) then (-9999) else
> ${INPUTVAR}[l=${l},m=${m}]
> set var/bad=-9999 tmp
> list/file="${OUTPUT}"/append/nohead "CHANGE";
> list/file="${OUTPUT}"/append/nohead/format=(${LONPOINTS}(f10.2)) tmp
>  done
>     done
> done
>
> But the problem is list/format=(${LONPOINTS}(f10.2)) lists the data
> from lower row. Is there any way that I can list the data from first
> row in the up then the generated text file become similar to what I
> see if I simply use list?!
>
> Thanks,
> Sanaz
>

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement