Project

General

Profile

Converting .dat to .nc

Added by Lucas Do over 4 years ago

Hello,

I'm trying to convert a .dat file that has lat/lon fields to .nc to be mapped. From previous threads here it seems that I do so in CDO using a gridfile, but I've been unable to set one up successfully.

Attached are the .dat file I want to convert, a .nc4 file that has the proper time/lat/lon, and the gridfile I've been trying to use.

Any help with this will be appreciated.

-Lucas


Replies (2)

RE: Converting .dat to .nc - Added by Karin Meier-Fleischer over 4 years ago

Hi Lucas,

sorry, but cdo is not able to handle this kind of data.

Your data (snippet):

Lat                Lon            Year        Day        DVS        WLV        WST        WSO        WRT    
  42.75     -92.25        1950        243        2.01    724.31    4969.89    6948.55    1295.55    0.79     ...
  42.75     -92.25        1951        283        2.00    541.69    3164.83    5733.74    1303.49    0.54     ...
  42.75     -92.25        1952        254        2.01    729.46    4125.05    8992.05    1133.29    0.87     ...
  42.75     -92.25        1953        250        2.01    629.51    4040.33    1839.35    1307.52    0.71     ...
...
  42.75     -92.25        2003        284        2.00    518.82    3161.21    5696.08    1072.08    0.53     ...
  42.75     -92.25        2004        272        2.00    961.94    4073.89    8161.42    1454.82    0.96     ...
  42.75     -92.25        2005        289        2.00    751.27    2812.09    9403.57    871.56    0.79     ...
  42.25     -92.25        1950        239        2.01    845.26    5172.65    7003.93    1532.19    0.89     ...
  42.25     -92.25        1951        290        2.00    550.46    2915.69    5617.23    1155.08    0.56     ...
...

You can use a shell script to extract the variable you need and sort it by time. Or you use NCL to read the data and bring the data in an acceptable format to write it to a netCDF file.

-Karin

RE: Converting .dat to .nc - Added by Lucas Do over 4 years ago

Karin,

Thanks for the reply, I'll look into doing that.

-Lucas

    (1-2/2)