[Thread Prev][Thread Next][Index]

Re: [ferret_users] Load data onto K axis



Hi,
Have a look at the section "append, slab to NetCDF, example"  in the Ferret Users Guide index,
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/converting-to-netcdf/SIMPLE-CONVERSIONS-USING-FERRET#_VPINDEXENTRY_1071

That example shows opening a set of ascii files and appending the data from each one to a file.  Your case is using netCDF files as the input. Say for example that file001.nc has K=1, file002.nc has K=2, etc, and that the depth or altitude values are increasing with each K, say for instance, Z=0, 1, 2, 3, ..., 99. 

You'll define the final z axis with all depths, and regrid the incoming data to that big axis.  This will put the data from each file onto the correct level of the output axis. Use regridding to put the variable from the first file onto the first level of this axis and then write it to the output file. On this first write, tellFerret the length of the entire axis, and that you're writing just the k=1 level.  Then
do the same with the other files, appending in the K direction.

As long as the data in all the files have the same grid in XYT, you don't need to do anything to preserve those other dimensions.

The details of defining the output axis, regridding to the output axis, and naming the files will depend on your data, but here is the general sequence of commands:

! Define the output axis.

define axis/z=0:99:1/units=meters/depth zax

! save the first dataset to the output file, writing the entire Z axis with the /KLIMITS qualifier,
! but saving just the /K=1 level.

use file001.nc
let/units="`var,return=units`"/title="`var,return=title`"  var_out = var[gz=zax]
save/clobber/file=file_all.nc/klimits=1:100/k=1  var_out
cancel data 1

! Open each file. This is a way to access files if they are named by the k level:

repeat/k=2:100:1 (def symbol kk = `k`; \
  define symbol filename = file00($kk).nc; \
  if `($kk) GT 9` then define symbol filename = file0($kk).nc; \
  if `($kk) GT 99` then define symbol filename = file($kk).nc; \
  use ($filename); \
  let/units="`var,return=units`"/title="`var,return=title`"  var_out = var[gz=zax]; \
  save/append/file=file_all.nc/k=($kk) var_out;\
  cancel data 1)


-Ansley




On 6/14/2013 7:03 AM, Akshay Hegde wrote:
I think it's not possible using the data file you have  posted.. since K axis dimension is not same.

Akshay Hegde,
National Institute of Oceanography,
Dona Paula, Goa


On Fri, Jun 14, 2013 at 6:45 PM, Kamoru Abiodun Lawal <lawal_ka@xxxxxxxxxxx> wrote:
  Dear Ferreters,

Please help......
I have 100 data with the each having the structure below:

   name       title                                  I          J         K         L
  TEMP     Temperature                  1:144     1:96      1:1       1:54

However, I want to join the data together onto the K-axis to look like

    name       title                               I            J           K           L
  TEMP     Temperature                  1:144     1:96      1:100       1:54

 and retain the dimensions of I, J and L axes.
Cheers!
Kamoru Abiodun LAWAL
Climate System Analysis Group,
Department of Environmental and Geographical Science,
University of Cape Town, Private Mail Bag X3,
Rondebosch, Cape Town, 7701, South Africa.
.......there's no wrong time for doing the right things..........
<<<<--------------------------------------------------------------------------------------------------->>>>




[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement