Results 1 to 4 of 4

Thread: Convert netcdf to plain ASCII

  1. #1
    Join Date
    Apr 2006
    Location
    Dortmund
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Convert netcdf to plain ASCII

    Hello fellow forum users,

    i am a student of geoscience and pretty new to the wide field of NCEP/NCAR reanalysis data. First i have to say that my overall aim is to get the data into a plain ASCII format for further analysis (spatial and temporal) in a GIS. Therefor i have to convert the netcdf files into normal ASCII textfiles. And there i have a problem. I use ncdump to convert the data, but the result always is frustrating. There is another user who seemed to have the same problem a few month ago.
    Here is the link to the post:

    http://www.oceanographers.net/forums...ghlight=netcdf

    Actually my russian language skills arenīt the best

    Here is a part of the result after the data was convertet with ncdump (air temperature in kelvin):

    netcdf air2004 {
    dimensions:
    lon = 144 ;
    lat = 73 ;
    time = 366 ;
    variables:
    float lat(lat) ;
    lat:units = "degrees_north" ;
    lat:actual_range = 90.f, -90.f ;
    lat:long_name = "Latitude" ;
    float lon(lon) ;
    lon:units = "degrees_east" ;
    lon:long_name = "Longitude" ;
    lon:actual_range = 0.f, 357.5f ;
    double time(time) ;
    time:units = "hours since 1-1-1 00:00:0.0" ;
    time:long_name = "Time" ;
    time:actual_range = 17557968., 17566728. ;
    time:delta_t = "0000-00-01 00:00:00" ;
    time:avg_period = "0000-00-01 00:00:00" ;
    short air(time, lat, lon) ;
    air:long_name = "mean Daily Air temperature at sigma level 995" ;
    air:valid_range = 185.16f, 331.16f ;
    air:actual_range = 185.16f, 316.13f ;
    air:units = "degK" ;
    air:add_offset = 512.81f ;
    air:scale_factor = 0.01f ;
    air:missing_value = 32766s ;
    airrecision = 2s ;
    air:least_significant_digit = 1s ;
    air:GRIB_id = 11s ;
    air:GRIB_name = "TMP" ;
    air:var_desc = "Air temperature\n",
    "A" ;
    air:dataset = "NCEP Reanalysis Daily Averages" ;
    air:level_desc = "Surface\n",
    "0" ;
    air:statistic = "Mean\n",
    "M" ;
    airarent_stat = "Individual Obs\n",
    "I" ;

    // global attributes:
    :Conventions = "COARDS" ;
    :title = "mean daily NMC reanalysis (2004)" ;
    :base_date = 2004s, 1s, 1s ;
    :history = "created 2004/01/03 by Hoop (netCDF2.3)" ;
    :description = "Data is from NMC initialized reanalysis\n",
    "(4x/day). These are the 0.9950 sigma level values." ;
    latform = "Model" ;
    data:

    air =
    -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981, -25981,

    The problem is that i dont understand why always these huge negative numbers appear, although the actual range of the air temperature is between 185 and 332 kelvin. I guess it has something to do with data format of the variables within the netcdf files itself, but i am not sure.

    so..i hope that all of you understand my problem. If anyone has experience with converting these kinds of data, i would really appreciate any help, hints, suggestions and solutions.

    Thanks very much in advance!

    Toby

  2. #2
    Join Date
    Dec 2004
    Location
    Centre for Climate Change Research, Indian Institute of Tropical Meteorology, India
    Posts
    429
    Thanks
    14
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by Toby
    The problem is that i dont understand why always these huge negative numbers appear, although the actual range of the air temperature is between 185 and 332 kelvin. I guess it has something to do with data format of the variables within the netcdf files itself, but i am not sure.
    In the header details, do you see this:
    air:add_offset = 512.81f ;
    air:scale_factor = 0.01f ;

    So, you have to multiply the values by a scale factor 0.01 and then add the offset 512.8 to it. You'll get the output in the required range

    eg:
    -25981 * 0.01 = -259.81
    -259.81 + 512.81 = 253 Kelvin

  3. #3
    Join Date
    Feb 2005
    Location
    International Max Plank research School in Earth System Modelling/Hamburg/Germany
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The same was in this http://www.oceanographers.net/forum...ighlight=netcdf post in Russian.
    Nikolay Koldunov
    www.oceanographers.ru

  4. #4
    Join Date
    Apr 2006
    Location
    Dortmund
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi rocksea,

    thanks for your help. It works perfectly well. Such a long question and such a short answer

    Now the real work can begin

    And hi Nicolay,

    i am aware of your post in russian. As you can see, i refered to your thread in my first post, but actually i didnīt help me very much

    thanks to all!

    Toby

Similar Threads

  1. conversion of HDF to ASCII
    By satyabana in forum Oceanographic Applications & Data Analysis
    Replies: 3
    Last Post: 24th April 2010, 01:02 PM
  2. reading netcdf in MATLAB
    By deba in forum Oceanographic Applications & Data Analysis
    Replies: 20
    Last Post: 16th November 2009, 09:30 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •