[gradsusr] how to reveres latitudes in nc file

Lee Byerle lbyerle at yahoo.com
Tue Mar 26 15:32:05 EDT 2013


Kishore,
 
Below may also be helpful.  It is sample fortran code that can reverse the latitude indices, and writes back to binary (assuming .nc is first dumped to binary):
.
.
.
irec1=1
irec2=1
 
do nvar=1,5   !Variables in binary file, with u-wind
if(nvar.eq.1) then    
  do k=1,nk
    read(1,rec=irec1)vgrads  !read data in .nc file
    do i=1,ni
       do j=1,nj
           u(i,j,k)=vgrads(i,nj+1-j)               !reverse j-index
         enddo
      enddo
      irec1=irec1 + 1
     enddo
 
c now write to file w/latitude (j-index) reversed:
 
do k=1,nk
 do i=1,ni
   do j=1,nj
     var(i,j) = u(i,j,k)
    enddo
   enddo
   write(17,rec=irec2)var
   irec2=irec2 + 1
enddo
.
.
etc.
 
The new binary output, with latitude starting at +90, can be viewed with a .ctl file using options yrev.
 
Lee

From: Charles Seman - NOAA Federal <charles.seman at noaa.gov>
To: GrADS Users Forum <gradsusr at gradsusr.org> 
Sent: Tuesday, March 26, 2013 1:09 PM
Subject: Re: [gradsusr] how to reveres latitudes in nc file

Kishore,

Have you tried the "yrev" option? 
http://grads.iges.org/grads/gadoc/descriptorfile.html#OPTIONS

You would make a GrADS data descriptor file to open the .nc file, and 
include in the data descriptor file the line:
options yrev

Hope this helps,
Chuck

On 03/26/2013 01:40 AM, Kishore Babu wrote:
> Dear grads users,
>
> My nc file has latitudes as below
>
> latitude = -90, -87.5, -85, -82.5, -80, -77.5, -75, -72.5, -70, -67.5, -65,
>      -62.5, -60, -57.5, -55, -52.5, -50, -47.5, -45, -42.5, -40, -37.5,
> -35,
>      -32.5, -30, -27.5, -25, -22.5, -20, -17.5, -15, -12.5, -10, -7.5, -5,
>      -2.5, 0, 2.5, 5, 7.5, 10, 12.5, 15, 17.5, 20, 22.5, 25, 27.5, 30,
> 32.5,
>      35, 37.5, 40, 42.5, 45, 47.5, 50, 52.5, 55, 57.5, 60, 62.5, 65,
> 67.5, 70,
>      72.5, 75, 77.5, 80, 82.5, 85, 87.5, 90 ;
>
> But, I need to have latitudes in reveres such as below...
>
> latitude = 90, 87.5, 85, 82.5, 80, 77.5, 75, 72.5, 70, 67.5, 65, 62.5, 60,
>      57.5, 55, 52.5, 50, 47.5, 45, 42.5, 40, 37.5, 35, 32.5, 30, 27.5, 25,
>      22.5, 20, 17.5, 15, 12.5, 10, 7.5, 5, 2.5, 0, -2.5, -5, -7.5, -10,
> -12.5,
>      -15, -17.5, -20, -22.5, -25, -27.5, -30, -32.5, -35, -37.5, -40,
> -42.5,
>      -45, -47.5, -50, -52.5, -55, -57.5, -60, -62.5, -65, -67.5, -70,
> -72.5,
>      -75, -77.5, -80, -82.5, -85, -87.5, -90 ;
>
> Could you please anybody let me know how it is changed?
>
> Thank you in advance..
>
> Regards,
>
> Kishore
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>

-- 

Please note that Charles.Seman at noaa.gov should be considered my NOAA
email address, not cjs at gfdl.noaa.gov.

********************************************************************
  Charles Seman                                Charles.Seman at noaa.gov
  U.S. Department of Commerce / NOAA / OAR
  Geophysical Fluid Dynamics Laboratory        voice: (609) 452-6547
  201 Forrestal Road                              fax: (609) 987-5063
  Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not reflect any
official or unofficial position of the United States Federal Government,
the United States Department of Commerce, or NOAA."
_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130326/f0a8c197/attachment-0003.html 


More information about the gradsusr mailing list