[Thread Prev][Thread Next][Index]

Re: [ferret_users] saving variable value along with its lat lon and time info.



Thanks, Russ. With a few small modifications I was able to get exactly what I needed.

Best,
Paul

On Mon, Mar 20, 2017 at 5:50 PM, Russ Fiedler <russell.fiedler@xxxxxxxx> wrote:

Paul,

you should be able to do some masking and pack the good values using the COMPRESS* and COMPRESS*_BY functions.
If the number of good values is constant for each time step then packing into a 1D variable and looping is easy.

Say if the shape of our data is NXxNYxNT

let xarray= x[gx=var]+0*var
let yarray= y[gx=var]+0*var

def axis/x=1:`NX*NY` myx

let dummy=0*i[gx=myx]+0*t[gt=var]

let v2d=reshape(var,dummy)
let x2d=reshape(xarray,dummy)
let y2d=reshape(yarray,dummy)
! Get the number of good vallues

let numgood=`v2d[l=1,i=@ngd]`


let vcomp=compressi(v2d[i=1:`NX*NY`])
let xcomp=compressi(x2d[i=1:`NX*NY`])
let ycomp=compressi(y2d[i=1:`NX*NY`])

! First numgood values are good . only list those.

list/clobber/file="test.dat"/nohead/norowlab/i=1:`numgood` xcomp,ycomp,vcomp,TAX_DATESTRING(t[g=vcomp],vcomp,"")

 
This is untested but should be pretty close to what you want.

Russ



On 21/03/17 08:28, Paul Goddard wrote:
Is there a way to not include the novalue/missing data from the data file? 
I saw that using sed could remove the rows were the variable value was "...." in the .dat file; however, this method still requires saving all the missing value entries first, then uses sed to remove said rows.  My dataset is huge, so limiting the output in ferret before saving would be ideal.

Thanks again,

Paul

On Mon, Mar 20, 2017 at 12:50 PM, Paul Goddard <pgoddard@xxxxxxxxxxxxxxxxx> wrote:
Great, thank you Akshay!

Best,
Paul


On Mon, Mar 20, 2017 at 12:16 PM, Akshay Hegde <akshay.k.hegde@xxxxxxxxx> wrote:
Here is example using coads_climatology

akshay@db-3325:~$ ferret
     NOAA/PMEL TMAP
     FERRET v6.96 
     Linux 2.6.18-406.el5 64-bit - 12/02/15
     21-Mar-17 00:30    

yes? use coads_climatology
yes? sh d
     currently SET data sets:
    1> /usr/local/ferret/fer_dsets/data/coads_climatology.cdf  (default)
 name     title                             I         J         K         L         M         N
 SST      SEA SURFACE TEMPERATURE          1:180     1:90      ...       1:12      ...       ...
 AIRT     AIR TEMPERATURE                  1:180     1:90      ...       1:12      ...       ...
 SPEH     SPECIFIC HUMIDITY                1:180     1:90      ...       1:12      ...       ...
 WSPD     WIND SPEED                       1:180     1:90      ...       1:12      ...       ...
 UWND     ZONAL WIND                       1:180     1:90      ...       1:12      ...       ...
 VWND     MERIDIONAL WIND                  1:180     1:90      ...       1:12      ...       ...
 SLP      SEA LEVEL PRESSURE               1:180     1:90      ...       1:12      ...       ...
 
yes?  list/clobber/file="test.dat"/nohead/norowlab x[g=sst],y[g=sst],TAX_DATESTRING(t[g=sst],sst,""),sst,airt,speh
 LISTing to file test.dat
yes? spawn sed -i '/^ ----/d' test.dat


Now see the content of test.dat

Akshay Hegde,
Data and Information,
CSIR-NIO
https://about.me/akshay.k.hegde





On Mon, Mar 20, 2017 at 11:29 PM, Paul Goddard <pgoddard@xxxxxxxxxxxxxxxxx> wrote:
Hello all,

I have a netcdf file with coastal ssh values along the global coastlines and missing value/ no value at all other grid points.

I would like to extract the ssh values to a data file for use in a statistics software.

My question is whether I can create a data file where each entry (row) lists the ssh value, lon, lat, and time (in 4 separate columns). 

Furthermore, my data is over 7300 days (L axis); so I assume I will need to set up a repeat loop for this axis.

Any ideas of a good method to retrieve this data?

Thank you for your time,

Paul


On Mon, Mar 20, 2017 at 11:29 PM, Paul Goddard <pgoddard@xxxxxxxxxxxxxxxxx> wrote:
Hello all,

I have a netcdf file with coastal ssh values along the global coastlines and missing value/ no value at all other grid points.

I would like to extract the ssh values to a data file for use in a statistics software.

My question is whether I can create a data file where each entry (row) lists the ssh value, lon, lat, and time (in 4 separate columns). 

Furthermore, my data is over 7300 days (L axis); so I assume I will need to set up a repeat loop for this axis.

Any ideas of a good method to retrieve this data?

Thank you for your time,

Paul






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

Privacy Policy | Disclaimer | Accessibility Statement