Re: re-gridding bianary file

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 03 2013 - 07:39:08 MDT

What did you try? Did you read any documentation?
If you are new to NCl, read the mini-language manual at:
    http://www.ncl.ucar.edu/Document/Manuals/

Read the documentation for all the functions.

The following reads all the data into memory.
If you do not have enough memory, you will havle to
loop over each record.

   ntim = 7300
   klev = 17
   nlat = 73
   mlon = 144

   lat = fspan(-90, 90,nlat)
   lon = fspan( 0, 357.5, mlon)

   nlat2 = 90
   mlon2 = 180
   lat2 = fspan(-89, 89, nlat2)
   mlon2 = fspan( 1,359, mlon2)

   setfileoption("bin","ReadByteOrder","BigEndian")

   diri = "./"
   fili = "foo.73x144.bin" ; binary file

   diro = "./"
   filo = "foo.90x180.bin"

         ; read all the records
   x = fbindirread(diri+fili, 0, (/ntim,klev,nlat,mlon/), "float")
   printVarSummary(x)

   x_2x2 = linint2 (lon,lat, x, True, lon2,lat2, 0)
   printVarSummary(x_2x2)

   fbindirwrite(diro+filo, x_2x2)

On 6/2/13 9:06 PM, Bidyut Bikash Goswami wrote:
> Hi,
> Thank you for your mail. Following are the details of my binary data file.
>
> [1] What type of binary? flat binary or fortran sequential binary? => flat (access='direct')
>
> [2] What 'endian' is the binary? Big-Endian or Little-Endian? => Big-Endian
>
> [3] Is the ordering (lat x lon x lev x time) below from a fortran program? => YES (144 x 73 x 17 x 7300)
>
> [4] Is the grid rectilinear or curvilinear? => Rectilinear ( Actually I have two data sets 1x1 degrees and 2.5x2.5 degrees which I want to re-grid to 2x2 degrees. I used xconverter [http://badc.nerc.ac.uk/help/software/xconv/], but it is failing due to large data size.)
>
>
>
> Regards,
> Bidyut
>
> ----- Original Message -----
> | From: "Dennis Shea" <shea@ucar.edu>
> | To: "Bidyut Bikash Goswami" <bidyut@tropmet.res.in>
> | Cc: "ncl-talk" <ncl-talk@ucar.edu>
> | Sent: Saturday, June 1, 2013 6:04:27 PM
> | Subject: Re: re-gridding bianary file
> | This question is so general it is difficult to respond
> |
> | [1] What type of binary? flat binary or fortran sequential binary?
> |
> | [2] What 'endian' is the binary? Big-Endian or Little-Endian?
> |
> | [3] Is the ordering (lat x lon x lev x time) below
> | from a fortran program?
> |
> | [4] Is the grid rectilinear or curvilinear?
> |
> | ===
> | Generic approach for a rectilinear grid. Note: you must
> | read the documentation for the functions.
> |
> | (a) read binary file via 'fbinrecread' or 'fbindirread'
> | (b) for a rectilinear grid use 'linint2'
> | (c) binary: write the regridded file vi 'fbinrecwrite' or
> | 'fbindirwrite'
> | netCDF: see http://www.ncl.ucar.edu/Applications/method_1.shtml
> |
> |
> |
> | On 6/1/13 4:12 AM, Bidyut Bikash Goswami wrote:
> | > Dear All,
> | >
> | > How to re-grid a binary file (dimension : lat x lon x lev x time)
> | > and write it in a file?
> | >
> | > Thanks,
> | > Bidyut
> | > _______________________________________________
> | > ncl-talk mailing list
> | > List instructions, subscriber options, unsubscribe:
> | > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> | >
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 3 07:39:17 2013

This archive was generated by hypermail 2.1.8 : Tue Jun 04 2013 - 09:50:17 MDT