1
votes

I have netCDF dataset with x, y as spatial dimensions (in Lambert conic projection) which are just enumerated values [0:495], [0:309], and lat, lon variables as 2D meshes with shapes (309, 495).

I want to assign lon, lat variables to x, y dimensions to get projected data over longitudes and latitudes, but I couldn't find any reference how to do this.
Converting existing dataset would be great, but acceptable options are also recreating new netCDF dataset from existing, or generating hdf-5 instead.


Sorry to realize that my question is unintelligible. I'll try with another example which does not imply geographic spatial projection.

I have netCDF dataset with 3 dimensions. Vertical dimension altitude is expressed in units hPa, while dataset contains variable height which maps each altitude level to meters. I want to change netCDF dataset and assign height variable to altitude dimension. So that when I read netCDF dataset with a program of choice, it will read vertical dimension as height in meters, instead altitude in hPa.

Hope it's easier to understand now.

1
Do you have all the parameters needed for the Lambert projection? - user3344003
If you mean the proj string, I have it, but that's not necessary as I have exact lat, lon coordinates for every x, y dimension point. - vlad
Reading your question and all the comments so far, it is still confusing (to me at least) what exactly you want. Could you revise/elaborate? What is the output if you do ncdump -h on your dataset? - Spencer Hill
@Spencer Hill, I edited my question and tried to explain with another example, hopefully easier to understand. - vlad

1 Answers

3
votes

Rename the dimension altitude to height. This makes height (not altitude) the coordinate variable. The netCDF Operators (NCO) do this with: ncrename -d altitude,height in.nc out.nc