[gradsusr] Regridding

Marshall Mdoka marshall.mdoka at monash.edu
Thu Jul 11 11:25:10 EDT 2013


Hi,

I am still getting error of different grids using this following script:

'sdfopen /home/mmdoka/work/RegCM/runs/runs_mar2008/SRFs95_mar96_i96AVG.nc'
'sdfopen /home/mmdoka/work/obs/cru/CRUPRE.CDF'
*'sdfopen /home/mmdoka/work/obs/cmap/precip.mon.mean.nc'
*'sdfopen /home/mmdoka/work/obs/GPCP/precip.mon.mean.nc'

'set display color white'
'set grads off'
'set grid off'
'set map 1 1 6'
'set xlopts 1 8 0.18'
'set ylopts 1 8 0.18'
'set clopts 1 -1 0.16'
*set lon -40 60'
*set lat  -40 40'
'set x 1 105'
'set y 1 100'
'set mpdset hires'

'set dfile 1'
*define pre1=ave(ave(rt.1,t-1,t+1),time=$t1,time=$t2,12)
'define pre1=ave(rt.1,time=1jan'yr1',time=1mar'yr2')'
'set dfile 2'
*define pre=ave(ave(pr.2,t-30,t+60),time=$t1,time=$t2,365)
'define pre2=ave(pre,time=1jan'yr',time=1mar'yr2')'
'define pre3=lterp(pre1,pre2)'
'define b=pre1-pre3'


'set gxout shaded'

'set clevs -6 -5 -4 -3 -2 -1 1 2 3 4 5 6'
'set ccols 20 21 22 23 24 25 26 27 28 29 30 31 32'
'd b'

Please help.

Marshall

On 11/07/2013 03:58, gradsusr-request at gradsusr.org wrote:
> Send gradsusr mailing list submissions to
> 	gradsusr at gradsusr.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://gradsusr.org/mailman/listinfo/gradsusr
> or, via email, send a message with subject or body 'help' to
> 	gradsusr-request at gradsusr.org
>
> You can reach the person managing the list at
> 	gradsusr-owner at gradsusr.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gradsusr digest..."
>
>
> Today's Topics:
>
>     1. Re: help - NetCDF file (Matt Masarik)
>     2. Re: Data download help (Jennifer Adams)
>     3. Re: help - NetCDF file (Celso Bandeira de Melo Ribeiro)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 10 Jul 2013 12:43:38 -0700
> From: Matt Masarik <mmasarik at atmos.ucla.edu>
> Subject: Re: [gradsusr] help - NetCDF file
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID: <51DDB96A.9030601 at atmos.ucla.edu>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi Celso,
>
> you can solve this by using a small (3 line) control file
> that has the 365_day_calendar option specified.  Copy
> the following text into a file, say, amazonia.ctl
>
> DSET ^amazonia.clm2.h0.2002-01-04-00000.nc
> OPTIONS 365_day_calendar
> tdef time 3084 linear 16jan1850 1mo
>
> I put your file name in the DSET line already.  You will
> need to change the 3084 to the total number of time
> records in the file.  You can find this out by issuing
> the following at a command prompt:
>
> ncdump -c amazonia.clm2.h0.2002-01-04-00000.nc
>
> you will also need to change 16jan1850 to the start
> date of your data set, again use ncdump.
>
> Once you make those changes you should be able to open
> the file by using
>
> xdfopen amazonia.ctl
>
>
> Matt
>
>
> On 07/10/2013 11:50 AM, Celso Bandeira de Melo Ribeiro wrote:
>> Hello,
>> I'm working with GrADS Version 2.0.a9 in Linux Ubuntu 64-bit and I am not
>> able to open NetCDF file.
>> I am using the function "sdfopen" but an error message appears as sending
>> the attachment.
>> The message, as follows:
>>
>> ga-> sdfopen amazonia.clm2.h0.2002-01-04-00000.nc
>> Scanning self-describing file:  amazonia.clm2.h0.2002-01-04-00000.nc
>> SDF Error: 365 day calendars are no longer supported by sdfopen.
>>     To open this file with GrADS, use a descriptor file with
>>     a complete TDEF entry and OPTIONS 365_day_calendar.
>>     Documentation is at http://iges.org/grads/gadoc/SDFdescriptorfile.html
>> ga->
>>
>> I would like to know how solve this problem.
>> Thank you!
>> Celso
>>
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 10 Jul 2013 18:06:27 -0400
> From: Jennifer Adams <jma at cola.iges.org>
> Subject: Re: [gradsusr] Data download help
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID: <69A3750F-6920-4F19-997E-41F8B13C1D77 at cola.iges.org>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Dear All,
> Jim Potemra brings up a good point which is worth mentioning to the entire forum. You might want to read his message (included below) before reading the rest of my response.
>
> When reading netcdf files, GrADS doesn't read every time axis value to make sure the increment is the same throughout the file. It assumes a linear time axis and therefore only reads the first two values to get start time and increment. (If you provide all the time axis metadata in a descriptor, GrADS never checks the metadata in the data file at all).
>
> I encountered this problem with some CMIP5 data -- NCAR was missing some time steps in a model run, so just skipped it in the data and distributed a file that did not have a linear time axis. The missing grids were hidden in time axis values that did not increase linearly -- somewhere in the middle of a file was a delta-T twice as big as all the others. This is very difficult for GrADS to detect. My solution was to break the file into two parts at the point where the missing time occurred and rename the subset files with appropriate date strings. GrADS handled it from there.
>
> I believe it would be a performance hit to check the time axis values for all times in every file when opening a dataset, especially one being served via opendap. And I am unlikely to take a lot of time writing new code to slow down GrADS to accomodate (what I feel are) sloppy data practices. Gridded model output should be regularly spaced in time.
>
> It is my opinion that GrADS handles file aggregation elegantly, and all the other methods out there cannot compete, but I am obviously extremely biased.
>
> --Jennifer
>
>
>
>
> On Jul 10, 2013, at 5:18 PM, James T. Potemra wrote:
>
>> Hi Jennifer:
>>
>> Your suggestion on using the descriptor file is the better way to go, and it reminded me of an
>> issue with accessing aggregated files in GrADS.  It seems like GrADS gets time information from
>> the start and increment values.  If this is true, one could potentially run into problems with missing
>> files (times).
>> As example, let's say you have daily files for a week, but one day (Wednesday) is missing.  If you make
>> an aggregate file from the six valid days using ncrcat (or some other tool), then load this aggregated
>> file into GrADS and plot a timeseries, I think you will actually get a six-day plot from Sunday through
>> Friday, rather than a seven-day plot from from Sunday through Saturday with a gap for Wednesday.
>> Data that appear for "Wednesday"  are actually from "Thursday", and so on.
>>
>> This behavior can be especially problematic when reading files via OPeNDAP, since you can't really be
>> sure of the contents in the aggregated file unless you check the time values in the file.
>>
>> I could be wrong on this, so I didn't want to post to the listserv, but feel free to reply there...
>>
>> Thanks,
>>
>> Jim
>>
>> On 7/9/13 8:00 AM, Jennifer Adams wrote:
>>> You can skip the ncrcat step by using a GrADS descriptor file to aggregate the files together. Put the following three lines in a text file called air.sig995.xtl in the same directory with the data files:
>>>
>>> DSET ^air.sig995.%y4.nc
>>> OPTIONS template
>>> TDEF time 24107 linear 1jan1948 1dy
>>>
>>>
>>> Then open this data set with GrADS using the 'xdfopen' command:
>>>
>>> ga-> xdfopen air.sig995.xtl
>>>
>>> Now all the files appear as a single data set -- there is no need to concatenate them together. You can begin doing whatever data analysis you want with the data. If you want to create a subset of the data in a new file, have a look at the 'sdfwrite' command.
>>>
>>> --Jennifer
>>>
>>>
>>>
>>> On Jul 9, 2013, at 1:49 PM, James T. Potemra wrote:
>>>
>>>> Emily:
>>>>
>>>> The files in the URL below are served via ftp, so this is not really a GrADS issue.  Instead, you can use "wget" to retrieve all the files, then "ncrcat" to concatenate them all together.  For example,
>>>>
>>>> wget -r -A.nc ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis.dailyavgs/surface/
>>>>
>>>> will retrieve all the files on that page that end with ".nc".  Next,
>>>>
>>>> ncrcat -h air.sig995.*.nc one_big_file.nc
>>>>
>>>> will cat all the individual files into one big file.  "ncrcat" is part of the netCDF Operator (NCO) toolkit; more info at http://nco.sourceforge.net/
>>>>
>>>> Jim
>>>>
>>>> On 7/9/13 7:09 AM, Emily Wilson wrote:
>>>>> Hello All,
>>>>>
>>>>> I am wanting to write a GrADS script in emacs that downloads a bunch of NetCDF files from a website and                     compresses them into one large file.  The website is
>>>>>   http://www.esrl.noaa.gov/psd/cgi-bin/db_search/DBListFiles.pl?did=33&tid=38147&vid=668 and I want to download all of the NetCDF files on this page.  What commands can I use to do this task?  If this is not possible would it be possible to format a script so that from the webpage, each file is read individually and specific data is pulled in each file, wrote or saved to a master file then the same thing is done for the next file and so on?
>>>>> Thanks for the help in advance,
>>>>>
>>>>> Emily P. Wilson, Intern
>>>>> Research and Conservation Department
>>>>> Denver Botanic Gardens
>>>>> 1007 York St.
>>>>> Denver, CO 80206
>>>>> 720-865-3593
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> gradsusr mailing list
>>>>> gradsusr at gradsusr.org
>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>> _______________________________________________
>>>> gradsusr mailing list
>>>> gradsusr at gradsusr.org
>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>> --
>>> Jennifer M. Adams
>>> IGES/COLA
>>> 4041 Powder Mill Road, Suite 302
>>> Calverton, MD 20705
>>> jma at cola.iges.org
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
> --
> Jennifer M. Adams
> IGES/COLA
> 4041 Powder Mill Road, Suite 302
> Calverton, MD 20705
> jma at cola.iges.org
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130710/acfe625b/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Wed, 10 Jul 2013 22:58:21 -0300
> From: Celso Bandeira de Melo Ribeiro <celso.bandeira at ufjf.edu.br>
> Subject: Re: [gradsusr] help - NetCDF file
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID: <fba2a7cf0b3252757ee4437c5105c0d1 at localhost>
> Content-Type: text/plain; charset=UTF-8
>
> Hi Matt,
>
> Thank you very much for your attention and help.
> Worked perfectly I created the following file:
>
> DSET ^amazonia.clm2.h0.2002-01-01-00000.nc
> OPTIONS 365_day_calendar
> tdef time 4 linear 01jan2000 1mo
>
> I am working with 4 files (Daily), whose names are:
>
> amazonia.clm2.h0.2002-01-01-00000.nc
> amazonia.clm2.h0.2002-01-02-00000.nc
> amazonia.clm2.h0.2002-01-03-00000.nc
> amazonia.clm2.h0.2002-01-04-00000.nc
>
> The file opens perfectly in GrADS:
>
> ga-> xdfopen amazonia.ctl
> Scanning Descriptor File:  amazonia.ctl
> SDF file amazonia.clm2.h0.2002-01-01-00000.nc is open as file 1
> LON set to 279.062 311.875
> LAT set to -20.2999 6.45372
> LEV set to 0.00710064 0.00710064
> Time values set: 2000:1:1:0 2000:1:1:0
> E set to 1 1
> ga-> q file
> File 1 : CLM History file information
>    Descriptor: amazonia.ctl
>    Binary: amazonia.clm2.h0.2002-01-01-00000.nc
>    Type = Gridded
>    Xsize = 106  Ysize = 115  Zsize = 15  Tsize = 4  Esize = 1
>    Number of Variables = 175
>      ...
>       tsoi  15  t,z,y,x  soil temperature
>       tsoi_10cm  0  t,y,x  soil temperature in top 10cm of soil
>       tv  0  t,y,x  vegetation temperature
>       u10  0  t,y,x  10-m wind
>       urban_ac  0  t,y,x  urban air conditioning flux
>   ...
>
> But when I try to open in GrADS putting time as a variable (set 1 t 4)
> appears the following error message:
>
> ga-> set t 1 4
> Time values set: 2000:1:1:0 2000:4:1:0
> ga-> d tsoi
> Contouring: 273 to 279 interval 0.5
> gancgrid error: nc_get_vara_double failed; NetCDF: Index exceeds dimension
> bound
> Data Request Error:  Error for variable 'tsoi'
>    Error ocurred at column 1
> DISPLAY error:  Invalid expression
>    Expression = tsoi
> ga->
>
> You know how to help me change the time?
>
> All the best!
>
> Celso
>
>
>
> On Wed, 10 Jul 2013 12:43:38 -0700, Matt Masarik <mmasarik at atmos.ucla.edu>
> wrote:
>> Hi Celso,
>>
>> you can solve this by using a small (3 line) control file
>> that has the 365_day_calendar option specified.  Copy
>> the following text into a file, say, amazonia.ctl
>>
>> DSET ^amazonia.clm2.h0.2002-01-04-00000.nc
>> OPTIONS 365_day_calendar
>> tdef time 3084 linear 16jan1850 1mo
>>
>> I put your file name in the DSET line already.  You will
>> need to change the 3084 to the total number of time
>> records in the file.  You can find this out by issuing
>> the following at a command prompt:
>>
>> ncdump -c amazonia.clm2.h0.2002-01-04-00000.nc
>>
>> you will also need to change 16jan1850 to the start
>> date of your data set, again use ncdump.
>>
>> Once you make those changes you should be able to open
>> the file by using
>>
>> xdfopen amazonia.ctl
>>
>>
>> Matt
>>
>>
>> On 07/10/2013 11:50 AM, Celso Bandeira de Melo Ribeiro wrote:
>>> Hello,
>>> I'm working with GrADS Version 2.0.a9 in Linux Ubuntu 64-bit and I am
> not
>>> able to open NetCDF file.
>>> I am using the function "sdfopen" but an error message appears as
> sending
>>> the attachment.
>>> The message, as follows:
>>>
>>> ga-> sdfopen amazonia.clm2.h0.2002-01-04-00000.nc
>>> Scanning self-describing file:  amazonia.clm2.h0.2002-01-04-00000.nc
>>> SDF Error: 365 day calendars are no longer supported by sdfopen.
>>>     To open this file with GrADS, use a descriptor file with
>>>     a complete TDEF entry and OPTIONS 365_day_calendar.
>>>     Documentation is at
> http://iges.org/grads/gadoc/SDFdescriptorfile.html
>>> ga->
>>>
>>> I would like to know how solve this problem.
>>> Thank you!
>>> Celso
>>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr




More information about the gradsusr mailing list