Hi -
You can make one netcdf file with all of the data interpolated onto a
single z axis. This will be similar to the example in the Users Guide,
appending slabs to a netCDF file.
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/converting-to-netcdf/SIMPLE-CONVERSIONS-USING-FERRET#Chapter10-NetCDF
append
That example appends in depth, you will be appending one profile after
another in the x direction, after putting the data onto the same Z
axis. It will go something like this. I am guessing that your ascii
files contain depths and data values at each depth. (This script has
not been tested)
! Define an axis with the number of stations you will read,
whatever number that is
yes? LET nstations = 20
yes? DEFINE AXIS/X=1:`nstations`:1 xaxis
! Define the output Z axis. You can define this however you like,
perhaps like
! this for regular spacing, where you will put in the correct range
yes? DEFINE AXIS/Z=0:1000:20/DEPTH/UNITS=meters zaxis
! or, maybe an irregular axis, something like this:
yes? DEFINE AXIS/Z/DEPTH/UNITS=meters
zaxis={0,10,20,30,50,75,100,150,200,300,400,600,800,1000}
! Now read the first profile. Use the depths from the file to define
! the input z axis, and put the data variable onto that axis.
yes? FILE/VAR="zval, var" data1.dat
yes? DEFINE AXIS/Z/DEPTH/UNITS=meters z_in = zval
yes? LET v_in = var[gz=z_in@ASN]
! Now interpolate the data onto the common z axis
yes? LET var_on_z = ZAXREPLACE(v_in, Z[GZ=z_in], Z[GZ=zaxis])
! Put this onto an x axis at x=1.
! You can define units or missing-value flag for the data here
yes? DEFINE AXIS/X=1:1:1 xaxis1
yes? LET/UNITS="deg C"/BAD=999 var_out = var_on_z + 0*x[gx=xaxis1]
! Start the output netCDF file.
SAVE/FILE=all_stations.nc/XLIMITS=1:`nstations`/I=1 var_out
! Now do the same for the other stations. If the input files are named
in a systematic way, this
! could be done in a repeat loop. I'll just show how to do the next
file
yes? CANCEL DATA data1.dat
! Now read the first profile. Use the depths from the file to define
! the input z axis, and put the data variable onto that axis.
yes? FILE/VAR="zval, var" data2.dat
yes? DEFINE AXIS/Z/DEPTH/UNITS=meters z_in = zval
yes? LET v_in = var[gz=z_in@ASN]
! Now interpolate the data onto the common z axis
yes? LET var_on_z = ZAXREPLACE(v_in, Z[GZ=z_in], Z[GZ=zaxis])
! Put this onto an x axis at x=1 ( if
yes? DEFINE AXIS/X=2:2:1 xaxis1
yes? LET/UNITS="deg C"/BAD=999 var_out = var_on_z + 0*x[gx=xaxis1]
! Start the output netCDF file.
SAVE/FILE=all_stations.nc/APPEND/I=2 var_out
....
! After appending all the data, you can use your file. First cancel
! all input datasets and variable definitions
yes? CANCEL DATA/ALL
yes? CANCEL VARIABLE/ALL
yes? USE all_stations.nc
yes? SHOW data ! The variable var_out will depend on x and z
Now, if you have longitude values for the X station locations, you
could either define the original x axis with those values or define a
new x axis and after opening all_stations.nc, put the data onto that
new longitude axis.
Ansley
golla nageswararao wrote:
Actually, each station data is in ascii format with
different depth values. i.e., they are common for all stations and not
regular. How to call different netcdf files on one plot in ferret?
Ansley Manke <Ansley.B.Manke@xxxxxxxx> wrote:
Hi
Golla,
Do each the profiles have a depth axis? Or are they a list of values
and depths? Either way you can read in the data for each station and
use a regridding operation to interpolate the data onto a single depth
axis. Are the input data in ascii files? or individual NetCDF files?
If you write back with a little more information we can help you find a
solution to this.
Ansley
golla nageswararao wrote:
Hi all,
Recently I got one doubt regarding the making of netcdf
file. The problem is,
I have one transect data that at a particular latitude i am
having vertical temperature profiles at different longitudes. In that
the depths and depth intervals are not same for all the stations. I
want to single netcdf file to make a transect plot (fill). Is there any
way or If I put the data in different netcdf files for different
stations can I combinedly plot on one x-axis?
Thanks in advance.
With regards,
G.NageswaraRao.
From,
G.Nageswara Rao,
Research Scholar,
INCOIS,
Jeeidmetla,
Hyderabad.
Meet people who discuss and share your passions. Join them now.
|