# Re: [ferret_users] How to convert 3D data to 2D data.

Title: Signature
Well, you can try this:

Let var3d = SST

! Length of the new axis (longitude * latitude)
Let lonlat =  `var3D,R=ISIZE`*`var3D,R=JSIZE`

! Define a 2-D grid and a variable on it.
Define Axis /X=1:`lonlat`:1 land
Let var2d = 0*x[gx=land] + 0*t[gt=var3d]

! Use the RESHAPE function to create the output 2-D variable.
Let outvar = RESHAPE(var3d,var2d)

Save /File=file_2d.nc outvar

And then if you want (land, time) instead of (time,land), you can use NCO operators:
ncpdq -a LAND,TIME file_2d.nc file_2d_bis.nc

Bruno

On 02/12/2016 11:23 AM, Kishore Ragi wrote:
Thank you Martin and Bruno, but I could not follow as I am novice at ferret.

I am quite new to use 2D with time is one of the dimensions.

Actually my data has 3D with lon, lat and time as dimensions. I have to convert lon, lat grid data to 1D vector data (land as a dimesion). Overall, the data should be (land, time), instead of (lon, lat, time).

Any help on this.

Thank you.

Regards,
Kishore

PhD student in climate science,
National Institute of Technology, Rourkela,
India- 769008

On Fri, Feb 12, 2016 at 2:20 PM, Bruno Levier wrote:
Hi

This can help : http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2003/msg00843.html

Regards,
Bruno

On 02/12/2016 08:42 AM, Kishore Ragi wrote:
Dear ferret users,

I have 3D (for example   float shum(time, lat, lon) ) and want to convert it into 2D such as float shum(time,land). How to combine lat and lon?

Is it possible with ferret or any suggestions on this?

Thank you.

Regards,
Kishore

PhD student in climate science,
National Institute of Technology, Rourkela,
India- 769008

--
 Bruno LEVIER Monitoring and Forecasting Systems Evaluation Team +33 5 61 39 38 51 bruno.levier@xxxxxxxxxxxxxxxxx mercator-ocean.eu   marine.copernicus.eu

--
 Bruno LEVIER Monitoring and Forecasting Systems Evaluation Team +33 5 61 39 38 51 bruno.levier@xxxxxxxxxxxxxxxxx mercator-ocean.eu   marine.copernicus.eu