[Thread Prev][Thread Next][Index]

Re: [ferret_users] list variable



Do you want to take the data for variable Optical_Depth_Land_And_Ocean_Mean that is inside the polygon, and average it over x and y? 
- Yes exactly I have to do that.

This is the other calculation forget rf please consider new.jnl as a new script. Please take a look on line 15. to average polygon.

--
Regards,
Nitin Patil


On Thu, Jan 15, 2015 at 12:13 AM, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:
Hi,
Ok, did you mean to attach some other script temp.jnl two days ago?


Do you want to take the data for variable Optical_Depth_Land_And_Ocean_Mean that is inside the polygon, and average it over x and y?  Does the variable rf still come in somewhere?  Do you want to average it over time?  Or is this a separate calculation?





On 1/13/2015 8:14 PM, Nitin Patil wrote:
Dear Ansley,

Do you really mean that you want to average over those variables?  
-- yes I want to average variable values comes in xgp and ygp. So that I will get single mean value for one day. and I am using 122 days period, then I will get 122 values.

--
Regards,
Nitin Patil


On Tue, Jan 13, 2015 at 10:37 PM, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:
Hi,
I don't think I understand what you want to do. The variables xgp and ygp are simple lists on an x axis.  Do you really mean that you want to average over those variables? 

What are the grids of the variable rf and the variable Optical_Depth_Land_And_Ocean_Mean? 

Ansley




On 1/12/2015 9:05 PM, Nitin Patil wrote:
Dear Ansley,

Thanks for your code. I have one query which I forgot to mention in my earlier post that in the attached new code (temp.jnl) if I want to take average of xgp and ygp so that it will list k=1;105 values as the output.

What I tried is:
let cne_data_2000 = if gp eq 1 then gp*Optical_Depth_Land_And_Ocean_Mean[d=1,x=65:95@ave, y=5:40@ave,k=1:105] but not working!

any change? Please suggest...



--
Regards,
Nitin Patil


On Tue, Jan 13, 2015 at 4:02 AM, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:
Hi,
The pt_in_poly function makes a variable on the same XY grid as the incoming variable, so it's just marking whether grid points lie inside or outside the polygon.

Here are the commands in your script,
let xgp = {77,78,78,81,81,82,85,85,88,88,86,86,87,87,86,86,82,82,83,83,84,84,83,83,79,79,78,77,77}
let ygp = {31,31,30,30,29,29,28,28,27,24,24,24,23,20,20,19,19,20,20,21,21,24,24,25,25,27,27,27,27}
let gp = pt_in_poly(rf[d=1],xgp, ygp)
let cne_data_2000 = if gp eq 1 then gp*rf[d=1,l=18050:18171@ave]
First, I would suggest that you make your polygon a closed polygon by repeating the first point at the end of the lists.  This ensures that the function will work correctly.  It works by drawing lines across the polygon and seeing how many times the line crosses the outline of the polygon.  It might work fine with the unclosed polygon, but this will make it certain, and it means that you can draw the polygon on a map with "plot/vs/line xgp, ygp" .
let xgp = {77,78,78,81,81,82,85,85,88,88,86,86,87,87,86,86,82,82,83,83,84,84,83,83,79,79,78,77,77,77}
let ygp = {31,31,30,30,29,29,28,28,27,24,24,24,23,20,20,19,19,20,20,21,21,24,24,25,25,27,27,27,27,31}
Now,  I assume that what you want is only the data inside the polygon, listed with their longitude and latitude values.  You'll need to make the result of the function into a 1-D list, define variables with the corresponding longitude and latitude data, and then list out just the "lon, lat, data" for the points within the polygon.

! Define 2-D arrays, with the longitude values and the latitude
! values at each location of the grid
.
! (Try a SHADE plot of these variables to see what we are doing here)

let xpts = x[gx=rf[d=1]] + 0*y[gy=rf[d=1]]
let ypts = 0*x[gx=rf[d=1]] + y[gy=rf[d=1]]
! 1-Dimensional lists with the locations and all of the data in the
! variable cne_data_2000

let xlist = xsequence(xpts)
let ylist = xsequence(ypts)
let cne_data_2000_list = xsequence(cne_data_2000)

! We want just the locations where cne_data_2000 is valid.
! To pick out just some data in a variable use a mask.

let mask = if cne_data_2000_list then 1
let cne_out = mask * cne_data_2000_list
let x_out = mask * xlist
let y_out = mask * ylist

! The COMPRESS functions will move the valid values of these
! to the start of the list. Then we can list just the good data
! at the start of the 1-D lists.

! Make Ferret definitions for these variables, so the listing will have
! a useful header.
You will want to set up the right units and a
! descriptive title for the variable.


let/title=longitude/units=degrees_east lon =
compressi(x_out)
let/title=latitude/units=degrees_north lat =
compressi(y_out)
let/units=" "/title=" " rf_in_region =
compressi(cne_out)

let npts = mask[i=@ngd]
list/i=1:`npts` lon, lat, rf_in_region


On 1/11/2015 8:22 PM, Nitin Patil wrote:
Dear ferret users,

In the attached script I want to extract cne_data_2000 into ascii but what is happening is when I am doing:

list cne_data_2000 it is writing all the grid points in the domain. I require the points/values to be listed xgp and ygp only. Anyone knows where I am making mistake.


--
Regards,
Nitin Patil








Attachment: new.jnl
Description: Binary data


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

Privacy Policy | Disclaimer | Accessibility Statement