Converting from .nc to binary

brian vant-hull brianvanthull at YAHOO.COM
Tue Jan 8 10:13:06 EST 2008


Once you have the variable from the netcdf file read
into Grads, you can print it to a binary file:

set fwrite file.bin
set gxout fwrite
display variable

Yes, it looks like it's printing an image, but it's
actually printing the data in binary.  Welcome to
GrADS.

--- Costas Douvis <cdouvis at YAHOO.COM> wrote:

> In my case the correct map (with the correct
> coodrinates) can be plotted by gradsc using a .ctl
> file with the line:
>
> pdef 98 78 lcc 44.00 15.00 49.00 39.00 55.00 31.00
> 15.00 60000. 60000.
>
> But in that case the data file must be the usual
> fortran unformatted and direct output file. I know
> that for sure because the usual output of the model
> I use (RegCM3) is like that. This time I have
> problems because I used the PostProcess routines to
> interpolate the CRU database to the same grid and
> unfortunately the output is an .nc file.
>
> If I could somehow change the format of the file
> from .nc to the usual direct and unformatted fortran
> file I would be OK for now. Do you know how I could
> do that?
>
> Brian, in case you want to use this method be
> careful. If I remember correctly there is a number
> of ways to describe your grid and "lcc" (in the pdef
> line) is only one of them
>
> Kostas
>
> >Date:    Mon, 7 Jan 2008 05:58:07 -0800
> >From:    brian vant-hull <brianvanthull at YAHOO.COM>
> >Subject: Re: wrong coordinates when plotting from
> an .nc file
> >
> >Hi Costas;
> >I hope to do something similar in the near future,
> but
> >haven't started work on it yet.   What I want to do
> is
> >feed in  the data plus somewhat irregular (but
> >gridlike) lat and lon, and get out the data in a
> >projection that GrADS will plot.
> >
> >It looks like the projections described in the user
> >manual *might* do this, but I haven't figured out
> how
> >to feed in the original unprojected lat lon data.
> I
> >fear the lat lon grids are expected to be already
> >mercator projected.  If so I'll have to use IDL or
> >MatLab to warp my grid to the projection first, or
> >write a rebinning program and perhaps lose some
> >resolution.
> >
> >Anyone else out there: do we need to warp our data
> to
> >a given projection outside of GrADS, or will GrADS
> do
> >this for us?  I see no provision for feeding
> arbitrary
> >lat/lon grids into grads.
> >
> >(unless plotting as station data - though it
> doesn't
> >look like this will provide contoured output.)
> >
> >
> >--- Costas Douvis  <cdouvis at YAHOO.COM> wrote:
> >
> >> Thank you for your response Brian
> >>
> >> My grid has an interval of 50km. So when I use
> the
> >> usual "rectilinear" map projection (where the
> >> coordinates are latitude and longitude and a
> >> "square" of 10x10 degrees does appear as a
> square)
> >> my domain should look stretched towards the pole,
> >> narrow towards the equator and curved. But it
> >> doesn't: it appears rectangular
> >>
> >> I'm running SUSE 10.0 - 32bit
> >> and Grads version 1.8SL11
> >>
> >> Please let me know if this information is still
> not
> >> enough
> >>
> >> Kostas
> >>
> >>> Date:    Fri, 4 Jan 2008 07:18:23 -0800
> >>> From:    brian vant-hull
> >>>
> >>> Subject: Re: wrong coordinates when plotting
> from an
> >>> .nc  file
> >>>
> >>> You'll need to be more precise...for example if
> the
> >>> coordinates are in equal increments of lat and
> lon
> >>> then in an equal distance mapping they'd get
> >>> narrower
> >>> towards the poles, but the typical lat-lon plot
> >>> would
> >>> stretch it.  You must have something different,
> but
> >>> hard to tell what it is.
> >>>
> >>> I may not be able to answer the question, but
> for
> >>> someone else to answer it they'll need to know
> alot
> >>> more details!
> >>>
> >>> -Brian.
> >>>
> >>> > --- Costas Douvis  wrote:
> >>> >
> >>> > Hello and happy new year to everyone
> >>> >
> >>> > I have problem plotting the data from an .nc
> file.
> >>> I
> >>> > believe that the values of the field are
> correct
> >>> but
> >>> > the coordinates are "stretched" so that they
> fit
> >>> in
> >>> > a rectangle. The real grid comes from an RCM
> model
> >>> > and is getting narrower towards the equator.
> >>> >
> >>> > Thanks in advance for any help
> >>> > Kostas Douvis
>
>
>
>
>
>
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with
> Yahoo! Mobile.  Try it now.


Brian Vant-Hull
917-318-4481


      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page.
http://www.yahoo.com/r/hs



More information about the gradsusr mailing list