create longitude and latitude in netcdf

From: Jiaxin Zhang <jiaxinzhang3_at_nyahnyahspammersnyahnyah>
Date: Tue Jun 25 2013 - 17:26:12 MDT


I am a new NCL user. After having a look at the NCL Mini-Language Manual
and other resources in the NCL website I still could not find a solution
for this problem.

I have a netcdf file (attached file "") with air
temperature values and the only coordinates in the file are land numbers
(calculated from longitude and latitude values). However, I need to add the
traditional coordinates with longitude and latitude associated with air
temperature values in the netcdf file.

To calculate back longitude and latitude values from land values, there are
the following equations:

y = INT( (land 1) / 360) ! lat index from 0 to 179

x = land 360 * y ! lon index from 1 to 360

lat = 89.5 y

lon = -179.5 + x 1

I tried to do these calculations and create the variables y, x, lat and lon
in a new netcdf file and apparently this part works (can anyone please let
me know if this part is correct in the attached ncl code "newlonlat.ncl"?
It is the first time I am creating new variables in a netcdf file and I am
not completely sure that this is the best way to do it. I have used the
function "toint" to convert y to integer values). But one of the main
problems seems to be related with the number of dimensions. The original
netcdf has only 1 dimension (land), whereas in the new netcdf, I would need
to have more dimensions (at least longitude and latitude), and it seems
that this gives an error message. Also, longitude and latitude should be
coordinate variables for air temperature in the new netcdf file.

Could anyne please help me to find where the error lies and modify the
attached script to create the correct netcdf file, including new values for
longitude and latitude as coordinate variables for air temperature?

Any help will be very appreciated!

Thank you!

Jiaxin Zhang

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:

Received on Tue Jun 25 17:26:22 2013

This archive was generated by hypermail 2.1.8 : Mon Jul 01 2013 - 12:35:42 MDT