[gradsusr] netCDF control file

Heiner Körnich heiner at misu.su.se
Mon Nov 8 11:06:47 EST 2010


Hi Deniz,

when you write recognized "sdfopen" or "xdfopen", do you mean that grads
does not know the command? Is your grads-version compiled with
netcdf-support?

It is certainly a good thing to create netcdf-files, as they are
self-descriptive. But still you could write binary data from matlab with the
command fwrite:
http://www.mathworks.com/help/techdoc/ref/fwrite.html

Then you have to follow the logic of grads binary files, ie. first
longitude, then latitude, then height, then time, as described in the
manual.

So far,
Heiner

On Mon, Nov 8, 2010 at 4:25 PM, Deniz Demirhan Bari <bari at iap-kborn.de>wrote:

>  Hello Heiner,
>
> Thank you for your mail. I tried 'sdfopen ures.nc'  but neither grads 2.0
> nor grads 1.8 recognized sdfopen. Then I  prepared a control file as below,
> by looking at the “CDO sinfo ures.nc”.  Then tried  “xdfopen ures.ctl” but
> none of the grads versions recognized xdfopen again.
>
> *
>
> DSET  ^ures.nc
>
> DTYPE  netcdf
>
> UNDEF  -9e+33
>
> XDEF dimension1  96 LINEAR 0.000000 3.750000
>
> YDEF dimension2  48 LEVELS -87.159 -83.479 -79.777 -76.070 -72.362 -68.652
>
>                -64.942 -61.232 -57.521 -53.810 -50.099 -46.389
>
>                -42.678 -38.967 -35.256 -31.545 -27.833 -24.122
>
>                -20.411 -16.700 -12.989  -9.278  -5.567  -1.856
>
>                  1.856   5.567   9.278  12.989  16.700  20.411
>
>                 24.122  27.833  31.545  35.256  38.967  42.678
>
>                 46.389  50.099  53.810  57.521  61.232  64.942
>
>                 68.652  72.362  76.070  79.777  83.479  87.159
>
> ZDEF dimension3  114 LINEAR 1 1
>
> TDEF dimension4  1 LINEAR 00:00Z00jan0000 1mn
>
> TITLE  ures.grb  T31 grid
>
> VARS  1
>
> ures             114  1,100  ures
>
> ENDVARS
>
> *
>
>
>
> My data is three dimensionaI and if I try to save my data in an ASCII file
> in MATLAB it gives a two dimensional output. I also couldn’t solve this
> problem
>
> Thank you
>
> Deniz
>
>
>
>
>
> *Von:* gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org]
> *Im Auftrag von *Heiner Körnich
> *Gesendet:* Montag, 8. November 2010 14:06
> *An:* GrADS Users Forum
> *Betreff:* Re: [gradsusr] netCDF control file
>
>
>
> Hi Deniz,
>
> you don't nead a ctl-file to open a netcdf-file in grads. If your file
> follows the COARDS-standard, then you can open it with 'sdfopen ures.nc'.
> If grads won't recognise it, you might want to try an older grads-version.
> We had some problems here with grads 2.0 and netcdf.
>
> If grads still won't open your file, you can write a ctl-file and try to
> open that with the command 'xdfopen'. The ctl-file looks a bit different
> from standard ctl-files, look here:
> http://www.iges.org/grads/gadoc/gradcomdxdfopen.html
>
> Then, you would need the output from ncdump in order to know what is inside
> the netcdf-file. Alternatively you can use the climate data operators (CDO)
> with the command "cdo sinfo ures.nc".
> Or in matlab, if you have the mexnc-package installed, you read the
> information with
> info=nc_info('ures.nc')
> Then you can access all details in info.
>
> Finally, if it is only you who will use the data, it might be simpler to
> write binary output in matlab and use a standard ctl.
>
> Kind regards from Stockholm,
> Heiner
>
>  On Mon, Nov 8, 2010 at 10:11 AM, Deniz Demirhan Bari <bari at iap-kborn.de>
> wrote:
>
> Dear Grads users,
>
> I have calculated residual wind components in MATLAB and saved them in
> netCDF file. Now I want to read them in grads but I cannot create a netcdf
> control file.
>
> I tried to get the output of ncdump but my computer doesn’t recognize ncdump although I installed it.
>
> I am using the latest version of Grads on a Suse Linux computer.
>
> My attempt to create a ctl file is below:
>
> *
>
> DSET  ^ures.nc
>
> DTYPE  netCDF
>
> XDEF 96 LINEAR 0.000000 3.750000
>
> YDEF 48 LEVELS -87.159 -83.479 -79.777 -76.070 -72.362 -68.652
>
>                -64.942 -61.232 -57.521 -53.810 -50.099 -46.389
>
>                -42.678 -38.967 -35.256 -31.545 -27.833 -24.122
>
>                -20.411 -16.700 -12.989  -9.278  -5.567  -1.856
>
>                  1.856   5.567   9.278  12.989  16.700  20.411
>
>                 24.122  27.833  31.545  35.256  38.967  42.678
>
>                 46.389  50.099  53.810  57.521  61.232  64.942
>
>                 68.652  72.362  76.070  79.777  83.479  87.159
>
> ZDEF 114 LINEAR 1 1
>
> TDEF 1 LINEAR 00:00Z00jan0000 1mn
>
> OPTIONS yrev
>
> UNDEF  -9e+33
>
> VARS  1
>
> ures             114  1,100  ures
>
> ENDVARS
>
> *
>
> Thanks in advance
>
> Deniz DEMIRHAN BARI
>
> Leibniz-Institut für Atmosphärenphysik e.V.
> an der Universität Rostock
> Schlossstraße 6
> 18225 Kühlungsborn
>
>
>
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
>
> --
> Heiner Körnich
> Dept. of Meteorology            Tel:  +46 8 164333
> Stockholms University, SE-106 91 Stockholm, Sweden
> Email: heiner at misu.su.se   www.misu.su.se/~heiner/<http://www.misu.su.se/%7Eheiner/>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Heiner Körnich
Dept. of Meteorology            Tel:  +46 8 164333
Stockholms University, SE-106 91 Stockholm, Sweden
Email: heiner at misu.su.se   www.misu.su.se/~heiner/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20101108/98f16b4b/attachment-0003.html 


More information about the gradsusr mailing list