[Thread Prev][Thread Next][Index]

Re: [EXTERNAL] Re: [ferret_users] ensemble or compare data from two time series



Hello Xiaoyu
G'day
In the command below......
contour PRECIPITATION[d=1,L=@AVE]-PRECIPITATION[d=2,L=@AVE]

The error might be due to the different time axes of d=1 and d=2. I am guessing that d=1 is RCP and d=2 is the Historical data set. When you do the subtraction (or any arithmetic) the time axis must be the same length without any ambiguity. However, in your case, as I can see you want to get the difference between the Precip averaged over historical and RCP. So, in this case you have to fist store the average into a variable

let hist = PRECIPITATION[d=2,L=@AVE]      !!!! if d=2 is Historical data
let rcp = PRECIPITATION[d=1,L=@AVE]      !!!! if d=1 is RCP data

then 

let change = rcp - hist
contour change

I hope this will work.

why do you use 360 as your limits when your echunk is 5?
echunk is not the longitude axis, this is the M axis (i,j,k,l,m) and I used this exis to store the 20 models in the chunk of 5 at a time. This means at each time this will save 5 models on M axis. In this M=1 means cmip5 model number 1, M=2 means cmip5 model number 2.... etc. So the loop over M will run 4 times (20/5) i.e. total no. of models divided by echunk.

Let me know if I am unclear. Happy to help.

Take care

Cheers, Saurabh


On Tue, Jan 11, 2022 at 12:36 AM Xiaoyu Bai <xbai1@xxxxxxxx> wrote:
Dear Sayrabh,

Thank you for your script. 😸 Your method worked if I regrid my historical runs to RCPs. 😁 However, I still want to keep my historical time axis as 1950-2005 and RCP time axis as 2006-2099. But if I want to keep the time axis, I still get the same error. The strange thing is that even I do the most simple calculation: 

contour PRECIPITATION[d=1,L=@AVE]-PRECIPITATION[d=2,L=@AVE]
           *** NOTE: Ambiguous coordinates on T axis: PRECIPITATION[D=1,L=@AVE]-PRECIPITATION[D=2,L=@AVE]
 **ERROR: illegal limits: PRECIPITATION is not in the range T=30-DEC-2005 12:00:30-DEC-2099 00:00@AVE
          Axis extremes are T=30-DEC-1949 12:00:30-DEC-2005 00:00

I didn't regrid anything, I just simply read my data in and Ferret won't let me compare the average value. 

By the way, for your jnl, 

set list/xchunk=120/ychunk=63/zchunk=12/tchunk=66/echunk=5/deflate=2/shuffle/ncformat=4
save/i=1/j=1/k=1/l=1/m=1/ilimits=1:360/jlimits=1:126/klimits=1:36/llimits=1:132/mlimits=1:20/file=histrcp-2005-2015.nc/clob heatcal

why do you use 360 as your limits when your echunk is 5?

Thank you very much and stay healthy,

Xiaoyu


On Tue, Dec 28, 2021 at 5:51 AM saurabh rathore <rohitsrb2020@xxxxxxxxx> wrote:
Sorry for getting back late to you, might be the attached script be helpful for you. 

So basically I was having 20 CMIP models having the same variable name HEATCAL, so read the variable name and assign a new variable based on the model e.g. "rcpbb" which is model number two in my script. Then I regrid all the models according to my model number one on all the axes i.e. gz, gx, gy, and gt. I also apply the mask from my model number one so  that every model must look like model number one in x,y,z,t axes. 

Then I save all the models in x,y,z,t, and e axes. Here the "e" axis is equal to 20 which contains all the models.

Suppose if you want to plot a time series from model number 5 then you have to use the command like this
plot/x=85/y=16/k=15 heatcal[m=5]

This will plot a time series at lon=85, lat=16, depth level = 15 and for model number 5.

I hope this will solve your issue. Let me know if you have any questions.

Cheers, Saurabh

On Thu, Dec 2, 2021 at 8:24 AM Ryo Furue <furue@xxxxxxxxxx> wrote:
Dear  Xiaoyu,



use agg_macav2metdata_pr_NorESM1-M_r1i1p1_historical_1950_2005_CONUS_monthly.nc
yes? let/like=precipitation p_tave=precipitation[t=@AVE]
yes? save/file=NorESM_hist_ave.nc p_tave
 LISTing to file NorESM_hist_ave.nc
cancel data 1
yes? use NorESM_hist_ave.nc
yes? use agg_macav2metdata_pr_NorESM1-M_r1i1p1_rcp85_2006_2099_CONUS_monthly.nc
yes? let/d=2/like=precipitation p_tave=precipitation[t=@AVE,gxy=p_tave[d=1]]

I got an error saying:

**ERROR: variable unknown or not in data set: PRECIPITATION[T=@AVE]

In the second LET statement, the variable p_tave is re-defined using its own previous definition. Essentially,

let p_tave = precip[gxy=p_tave[d=1]]

But you have already canceled the former dataset 1 by "cancel data 1".

Although I don't know exactly what's happening in this case, I suspect this is the cause of the problem you encounter.  So, I suspect you'll get a result you like if you don't use the same name "p_tave" and don't cancel dataset 1.

Hope this helps,

Ryo




 


When I checked the data:

 sh data
     currently SET data sets:
    1> ./NorESM_hist_ave.nc
 name     title                             I         J         K         L
 P_TAVE   Monthly Precipitation Amount     1:251     1:144     ...       ...
       (T=30-DEC-1949 12:00:30-DEC-2005 00:00)
 
    2> ./agg_macav2metdata_pr_NorESM1-M_r1i1p1_rcp85_2006_2099_CONUS_monthly.nc  (default)
 name     title                             I         J         K         L
 PRECIPITATION
          Monthly Precipitation Amount     1:251     1:144     ...       1:1128
 ------------------------------
 P_TAVE[D=agg_macav2metdata_pr_NorESM1-M_r1i1p1_rcp85_2006_2099_CONUS_monthly] = PRECIPITATION[T=@AVE,GXY=P_TAVE[D=1]]
 
So I tested 

let test= PRECIPITATION[T=@AVE,d=2]-P_TAVE[d=1]

but still got the same error. Interestingly, If I only compare the two variables' T=@AVE, I got an error:

contour Precipitation[d=2,T=@AVE]-Precipitation[d=1,T=@AVE]
           *** NOTE: Ambiguous coordinates on T axis: PRECIPITATION[D=2,L=@AVE]-PRECIPITATION[D=1,L=@AVE]
 **ERROR: illegal limits: PRECIPITATION is not in the range T=30-DEC-1949 12:00:30-DEC-2005 00:00@AVE
          Axis extremes are T=30-DEC-2005 12:00:30-DEC-2099 00:00


I am using Pyferret v7.6 on Linux 4.15.0-1089-azure. I am wondering how to solve this problem.

Stay healthy,

Xiaoyu


On Wed, Nov 24, 2021 at 6:24 PM Ansley Manke <a.c.manke@xxxxxxxxx> wrote:
[Caution: Email from External Sender. Do not click or open links or attachments unless you know this sender.]
 

Hi,

Your datasets do not share a time range, so this is not a typical ensemble.

Usually, you can define an ensemble when the datasets do not have the same space/time grids,  by first defining a regridding operation so that all datasets have the same space/time grid as the first dataset in your list. On the page,

https://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/DEFINE#_define_data_agg

scroll down in that page to find "Ensemble Examples". Example 3 shows how to define an ensemble for data on two different grids, including for this data a modulo regridding operation to define variables with consistent grids. The variable names must also match, so that example also shows how to rename the file variable within the Ferret session, and then define the new regridded variables using the desired names.


I am not sure what commands you tried using @AVE.  If you did a time average, then the resulting grid no longer depends on time, so there should not be an error message about time axes. Look at this example:

! Make a file containing the variables in the first dataset, averaged in time. 
! An ensemble needs one file with the grid that is going to be used in the
! ensemble; not all of the grids can come from LET definitions.

yes? use dataset_1
yes? let/like=precip p_tave = precip [t=@ave]
yes? save/file=data1.nc p_tave
yes? cancel data 1

! Now open this data and define variables in the other dataset(s) so that
! they can be included in an ensemble.

yes? use data1.nc

yes? use dataset_2
yes? let/d=2/like=precip p_tave = precip[t=@ave,gxy=p_tave [d=1]]

yes? ensemble time_ave = 1,2

! The ensemble dataset should contain the variable p_tave with a grid in X-Y-E

yes? show data time_ave


On 11/18/2021 3:22 PM, Xiaoyu Bai wrote:
Dear ferreters,

I am trying to ensemble RCPs (2005-2099) and control runs (1949-2005) together but keep getting T axis differs error.

*** NOTE: Variable "PRECIPITATION" excluded from aggregate: T axis differs among members
 **ERROR: error defining aggregate dataset: No valid datasets or datasets share no variables that can be aggregated.

It makes sense for pyferret to think the time axis are different. But comparing the @AVE value from different time series should also make sense to pyferret. I am wondering how to solve this problem.

By the way, I already tried to read data in separately and do @AVE first then compare. It still showed the same error because the data still come from different time series. 


--
Xiaoyu (she/her)


--
Xiaoyu (she/her)


--


REGARDS

Saurabh Rathore
Research Scholar (PhD.)
Centre For Oceans, Rivers, Atmosphere & Land Science Technology
Indian Institute Of Technology, Kharagpur
contact :- 91- 8345984434


--
Xiaoyu (she/her)


--


REGARDS

Saurabh Rathore
Research Scholar (PhD.)
Centre For Oceans, Rivers, Atmosphere & Land Science Technology
Indian Institute Of Technology, Kharagpur
contact :- 91- 8345984434

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

Privacy Policy | Disclaimer | Accessibility Statement