[gradsusr] 回复: Concatenation on Windows OS

weatherman weather.man at aliyun.com
Tue Oct 3 07:19:10 EDT 2017


Hi ,Dr Ugochukwu K. Okoro  It is not the best way to merge all the files. I recommend  Using Templates .First of all you must write a description file for your data  Using TemplatesGrADS allows you use a single data descriptor file to aggregate multiple data files and handle them as if they were one individual file. The individual data files must be identical in the X, Y, and Z dimensions and have the same list of variables. The time range of each individual file must be indicated it its filename. Beginning with version 2.0, data files may also be aggregated in the ensemble dimension.First, the DSET entry has a substitution template instead of a filename. See below for a description of all the possible components of the template. Second, the OPTIONS entry contains the template keyword. Third, the TDEF entry describes the time range for the entire set of data files.Templating works on any GrADS data type for which you can write a descriptor file. If you specify any additional OPTIONS keywords in the data descriptor file, make sure the options apply equally to each file included in the template.You can use the set misswarn command to alert you if any of the data files in the templated set is missing.Templating over TIMEValid components of the substitution template for the TIME axis are as follows:%x1   1 digit decade 
%x3   3 digit decade 
%y2   2 digit year 
%y4   4 digit year 
%m1   1 or 2 digit month 
%m2   2 digit month (leading zero if needed) 
%mc   3 character month abbreviation 
%d1   1 or 2 digit day 
%d2   2 digit day (leading zero if needed) 
%h1   1 or 2 digit hour 
%h2   2 digit hour 
%h3   3 digit hour (e.g., 120 or 012) 
%n2   2 digit minute; leading zero if needed
%f2   2 digit forecast hour; leading zero if needed; more digits added for hours >99; hour values increase indefinitely
%f3   3 digit forecast hour; leading zeros if needed; more digits added for hours >999; hour values increase indefinitely
%fn2  2 digit forecast minute; leading zero if needed; more digits added for minutes > 99; minute values increase indefinitely (2.0.a9+)
%fhn  forecast time expressed in hours and minutes (hhnn) where minute value (nn) is always <=59
      and hour value (hh) increases indefinitely. If hh or nn are <=9, they are padded with a 0 
      so they are always at least 2 digits; more digits added for hours >99. (2.0.a9+)
%fdhn forecast time expressed in days, hours, and minutes (ddhhnn) where minute value (nn) is always <=59, 
      hour value (hh) is always <=23 and day value (dd) increases indefinitely. If dd, hh, or nn are <=9, 
      they are padded with a 0 so they are always at least 2 digits; more digits added for days >99. (2.0.a9+)
%j3   3 digit julian day (day of year) (2.0.a7+)
%t1   1 or 2 digit time index (file names contain number sequences that begin with 1 or 01) (2.0.a7+)
%t2   2 digit time index (file names contain number sequences that begin with 01) (2.0.a7+)
%t3   3 digit time index (file names contain number sequences that begin with 001) (2.0.a7+)
%t4   4 digit time index (file names contain number sequences that begin with 0001) (2.0.a8+)
%t5   5 digit time index (file names contain number sequences that begin with 00001) (2.0.a8+)
%t6   6 digit time index (file names contain number sequences that begin with 000001) (2.0.a8+)
%tm1  1 or 2 digit time index (file names contain number sequences that begin with 0 or 00) (2.0.a7+)
%tm2  2 digit time index (file names contain number sequences that begin with 00) (2.0.a7+)
%tm3  3 digit time index (file names contain number sequences that begin with 000) (2.0.a7+)
%tm4  4 digit time index (file names contain number sequences that begin with 0000) (2.0.a8+)
%tm5  5 digit time index (file names contain number sequences that begin with 00000) (2.0.a8+)
%tm6  6 digit time index (file names contain number sequences that begin with 000000) (2.0.a8+)
When specifying the initial time (e.g., NWP model output), use these substitutions:%ix1   initial 1 digit decade 
%ix3   initial 3 digit decade 
%iy2   initial 2 digit year 
%iy4   initial 4 digit year 
%im1   initial 1 or 2 digit month 
%im2   initial 2 digit month (leading zero if needed) 
%imc   initial 3 character month abbreviation 
%id1   initial 1 or 2 digit day (leading zero if needed) 
%id2   initial 2 digit day 
%ih1   initial 1 or 2 digit hour 
%ih2   initial 2 digit hour 
%ih3   initial 3 digit hour 
%in2   initial 2 digit minute (leading zero if needed)
Templating over ENSEMBLEWith the introduction of the extra grid dimension for ensembles in version 2.0, support was also added for file templating over E. The sole substitution template is %e and the substitution string is the ensemble name, which is provided in the EDEF entry in the descriptor file. Note that the ensemble names are limited to 15 characters -- keep this limit in mind when designing your data directory structure and file naming conventions (or use symbolic links to create short aliases for longer filenames). If you are templating over the ensemble dimension, there can be only one ensemble member per file. If your data set has an ensemble dimension, and you are using templating over T but not E (i.e., there is no %e in the DSET entry), then all ensemble members are presumed to have identical time axes, and all members must be contained in the data file for a given time. Templating over T but not E is not supported for data sets in flat binary or GRIB1 formats.String SubstitutionThe %ch template option, introduced in version 1.9b4, allows for any user-specified string substitution, not just date strings. This is useful when none of the above template options match the time ranges in the files you wish to aggregate, or if the files are located on different disk pathnames. The syntax is as follows:%ch   substitute stringIf you put the %ch template in your DSET entry, then you also need to put additional CHSUB entries in the descriptor file that contain two integers (t1 and t2) followed by a string which will be substituted for %ch in the data file names for the time steps beginning with
t1 and ending with t2. The CHSUB descriptor file entries have the following syntax:CHSUB  t1  t2  stringVersion 2.1.a3 adds a new feature to the string substitution template: the string provided in the CHSUB entry may contain time-based template components. GrADS will do the CHSUB string substitution before the complete filename is generated by resolving all the other template substitution components. An application of this strategy might be to merge a reanalyis and forecast into one seamless time series, but the reanalyes and forecasts have different file naming conventions. See example #6 below.ExamplesHere's a set of binary files spanning a single month, where each day's worth of hourly data is contained in individual files: 
   1may92.dat
   2may92.dat
   ...
   31may92.dat 
Three records must be modified in the data descriptor file. Note that the TDEF entry reflects the entire month's worth of data: 
   DSET ^%d1may92.dat
   OPTIONS template
   TDEF 744 linear 0z1may1992 1hr 

If your data set expanded, and there were more files containing hourly data for other months and years: 
   1jun92.dat
   2jun92.dat
   ...
   1jan93.dat 
Then you would add a template for month and year in your DSET entry and extend the length of your TDEF: 
   DSET ^%d1%mc%y2.dat
   OPTIONS template
   TDEF 6624 linear 0z1may1992 1hr


Suppose you have a set of seven netcdf files, each containing monthly data spanning a decade:
   pr.1880_1889.nc
   pr.1890_1899.nc
   pr.1900_1909.nc
   pr.1910_1919.nc
   pr.1920_1929.nc
   pr.1930_1939.nc
   pr.1940_1949.nc
Then your descriptor file would include the following entries:
   DSET ^pr.%x30_%x39.nc 
   OPTIONS template 
   DTYPE netcdf 
   TDEF 840 linear jan1880 1mo 

Here are two netcdf files, one containing 50 years of monthly data (600 time steps), the other 100 years (1200 time steps): 
   pr.1851-1900.nc
   pr.1901-2000.nc 
Your descriptor file should include the following entries:
   DSET ^pr.%ch.nc
   CHSUB   1  600 1851-1900
   CHSUB 601 1800 1901-2000
   OPTIONS template
   DTYPE netcdf
   TDEF 1800 linear jan1851 1mo
If these two data files were located on different disks, you could write out the relevant descriptor file entries this way instead:
   DSET %ch
   CHSUB   1  600 /disk1/pr.1851-1900.nc
   CHSUB 601 1800 /disk2/pr.1901-2000.nc

Your forecast model output looks like this:
  MMOUT_DOMAIN1_00
  MMOUT_DOMAIN1_01
  MMOUT_DOMAIN1_02
so your DSET enry will look like this: 
  DSET ^MMOUT_DOMAIN1_%tm2

Here is an example of using different time template substitutions within a %ch string substitution. 
  DSET /data/projects/ops/pub/%ch
  CHSUB 1    1898 das/Y%y4/M%m2/D%d2/GEOS.fp.asm.inst3_2d_smp_Nx.%y4%m2%d2_%h2%n2.V01.nc4
  CHSUB 1899 1909 forecast/Y2014/M10/D15/H06/GEOS.fp.fcst.inst3_2d_smp_Nx.20141015_06+%y4%m2%d2_%h2%n2.V01.nc4
  OPTIONS template
------------------------------------------------------------------发件人:ugo okoro <uknac23 at yahoo.com>发送时间:2017年10月3日(星期二) 17:05收件人:gradsusr at gradsusr.org <gradsusr at gradsusr.org>主 题:[gradsusr] Concatenation on Windows OS
Dear All,I want to concatenate a number of daily_data.nc on Windows OS. Please can someone identify a script that works on OpenGrADS 2.0.
Thanks. Dr Ugochukwu K. Okoro


 On Monday, October 2, 2017 11:55 PM, "gradsusr-request at gradsusr.org" <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: Maskout two different fields (Andrew Friedman)
   2. Re: Maskout two different fields (Daniel Nairn)
   3. Re: Maskout two different fields (Andrew Friedman)
   4. Re: Maskout two different fields (Daniel Nairn)
   5. Re: Maskout two different fields (Jeff Duda)


----------------------------------------------------------------------

Message: 1
Date: Sun, 1 Oct 2017 22:55:38 +0200
From: Andrew Friedman <andfried at gmail.com>
Subject: Re: [gradsusr] Maskout two different fields
To: GrADS Users Forum <gradsusr at gradsusr.org>
Message-ID: <140EC942-0F86-4C2E-8BCE-52CCFC174ED2 at gmail.com>
Content-Type: text/plain; charset=us-ascii

Hi Daniel,

What if you simplify it by just looking at the inner loop: maskout(cape,myhel-100)? Does the output look correct? Then you can build on it by adding the successive const loops.

Andrew

> On Oct 1, 2017, at 12:59 PM, Daniel Nairn <dannairn at gmail.com> wrote:
> 
> Hello
> 
> I am trying to plot a chart (from one ensemble member) that displays SBCAPE where 0-1km helicity is greater than 100. This is how my current script looks
> 
> 'define cape = capesfc(e=2)'
> 'define myhel = HLCY0_1000m(e=2)'
> 'define capehel = const(const(maskout(cape,myhel-100),1),0.0,-u)'
> 'd capehel'
> 
> I'm not convinced this is correct as my final image output does not show any CAPE values where expected. Can anybody help at all?
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr




------------------------------

Message: 2
Date: Mon, 2 Oct 2017 08:00:59 +0100
From: Daniel Nairn <dannairn at gmail.com>
Subject: Re: [gradsusr] Maskout two different fields
To: GrADS Users Forum <gradsusr at gradsusr.org>
Message-ID:
    <CAPo+bHo9ut7EOP0hUDdW+0dBHfBUULKjkTzLpyDcCKKb9tyf3Q at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hello Andrew

Yes I simplified the script as suggested at that does look much better,
thank you. Not quite sure what I've done wrong with the const loops though.

On 1 October 2017 at 21:55, Andrew Friedman <andfried at gmail.com> wrote:

> Hi Daniel,
>
> What if you simplify it by just looking at the inner loop:
> maskout(cape,myhel-100)? Does the output look correct? Then you can build
> on it by adding the successive const loops.
>
> Andrew
>
> > On Oct 1, 2017, at 12:59 PM, Daniel Nairn <dannairn at gmail.com> wrote:
> >
> > Hello
> >
> > I am trying to plot a chart (from one ensemble member) that displays
> SBCAPE where 0-1km helicity is greater than 100. This is how my current
> script looks
> >
> > 'define cape = capesfc(e=2)'
> > 'define myhel = HLCY0_1000m(e=2)'
> > 'define capehel = const(const(maskout(cape,myhel-100),1),0.0,-u)'
> > 'd capehel'
> >
> > I'm not convinced this is correct as my final image output does not show
> any CAPE values where expected. Can anybody help at all?
> >
> > _______________________________________________
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20171002/c1993263/attachment-0001.html 

------------------------------

Message: 3
Date: Mon, 2 Oct 2017 12:52:54 +0200
From: Andrew Friedman <andfried at gmail.com>
Subject: Re: [gradsusr] Maskout two different fields
To: GrADS Users Forum <gradsusr at gradsusr.org>
Message-ID: <877F230E-6AB9-43AF-8199-72820E086481 at gmail.com>
Content-Type: text/plain; charset=us-ascii

Hi Daniel,
Could it be an issue with contour shading? If you pick a point where you know there is a value, is the output correct?
Andrew

> On Oct 2, 2017, at 9:00 AM, Daniel Nairn <dannairn at gmail.com> wrote:
> 
> Hello Andrew
> 
> Yes I simplified the script as suggested at that does look much better, thank you. Not quite sure what I've done wrong with the const loops though.
> 
> On 1 October 2017 at 21:55, Andrew Friedman <andfried at gmail.com> wrote:
> Hi Daniel,
> 
> What if you simplify it by just looking at the inner loop: maskout(cape,myhel-100)? Does the output look correct? Then you can build on it by adding the successive const loops.
> 
> Andrew
> 
> > On Oct 1, 2017, at 12:59 PM, Daniel Nairn <dannairn at gmail.com> wrote:
> >
> > Hello
> >
> > I am trying to plot a chart (from one ensemble member) that displays SBCAPE where 0-1km helicity is greater than 100. This is how my current script looks
> >
> > 'define cape = capesfc(e=2)'
> > 'define myhel = HLCY0_1000m(e=2)'
> > 'define capehel = const(const(maskout(cape,myhel-100),1),0.0,-u)'
> > 'd capehel'
> >
> > I'm not convinced this is correct as my final image output does not show any CAPE values where expected. Can anybody help at all?
> >
> > _______________________________________________
> > 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
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr




------------------------------

Message: 4
Date: Mon, 2 Oct 2017 12:12:58 +0100
From: Daniel Nairn <dannairn at gmail.com>
Subject: Re: [gradsusr] Maskout two different fields
To: GrADS Users Forum <gradsusr at gradsusr.org>
Message-ID:
    <CAPo+bHpL0gBngdi7B1G1Mkx560L5sUSS=0VHCyCyU9RKXRgvCQ at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

No I don't think so, what I've done is break down the script (as below)
again and this now actually looks okay

'define cape = capesfc'
'define myhel = HLCY0_1000m'
'define myval = maskout(cape,myhel-100)'
'define myval2 = const(myval, 0, -u)'
'd myval2'

I'm still unsure as to what I'm doing wrong when its all combined into one
line, but at least this appears to be working. Thank you.



On 2 October 2017 at 11:52, Andrew Friedman <andfried at gmail.com> wrote:

> Hi Daniel,
> Could it be an issue with contour shading? If you pick a point where you
> know there is a value, is the output correct?
> Andrew
>
> > On Oct 2, 2017, at 9:00 AM, Daniel Nairn <dannairn at gmail.com> wrote:
> >
> > Hello Andrew
> >
> > Yes I simplified the script as suggested at that does look much better,
> thank you. Not quite sure what I've done wrong with the const loops though.
> >
> > On 1 October 2017 at 21:55, Andrew Friedman <andfried at gmail.com> wrote:
> > Hi Daniel,
> >
> > What if you simplify it by just looking at the inner loop:
> maskout(cape,myhel-100)? Does the output look correct? Then you can build
> on it by adding the successive const loops.
> >
> > Andrew
> >
> > > On Oct 1, 2017, at 12:59 PM, Daniel Nairn <dannairn at gmail.com> wrote:
> > >
> > > Hello
> > >
> > > I am trying to plot a chart (from one ensemble member) that displays
> SBCAPE where 0-1km helicity is greater than 100. This is how my current
> script looks
> > >
> > > 'define cape = capesfc(e=2)'
> > > 'define myhel = HLCY0_1000m(e=2)'
> > > 'define capehel = const(const(maskout(cape,myhel-100),1),0.0,-u)'
> > > 'd capehel'
> > >
> > > I'm not convinced this is correct as my final image output does not
> show any CAPE values where expected. Can anybody help at all?
> > >
> > > _______________________________________________
> > > 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
> >
> > _______________________________________________
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20171002/ab4fffdd/attachment-0001.html 

------------------------------

Message: 5
Date: Mon, 2 Oct 2017 10:50:04 -0500
From: Jeff Duda <jeffduda319 at gmail.com>
Subject: Re: [gradsusr] Maskout two different fields
To: GrADS Users Forum <gradsusr at gradsusr.org>
Message-ID:
    <CAAig09CAmXct31OiHAfwNM56jHMsA=9U0fKLD-b-B4+TLapdUA at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Daniel,
Why are you applying the const() function in this problem? From your code,
myval2 should be a field of all zeros except for in the masked area. I
would think you would want to plot myval only. If myval looks wrong then
either your cape or helicity fields are full of bad data. I would display
each separately to confirm if that is a problem.

Jeff Duda

On Mon, Oct 2, 2017 at 6:12 AM, Daniel Nairn <dannairn at gmail.com> wrote:

> No I don't think so, what I've done is break down the script (as below)
> again and this now actually looks okay
>
> 'define cape = capesfc'
> 'define myhel = HLCY0_1000m'
> 'define myval = maskout(cape,myhel-100)'
> 'define myval2 = const(myval, 0, -u)'
> 'd myval2'
>
> I'm still unsure as to what I'm doing wrong when its all combined into one
> line, but at least this appears to be working. Thank you.
>
>
>
> On 2 October 2017 at 11:52, Andrew Friedman <andfried at gmail.com> wrote:
>
>> Hi Daniel,
>> Could it be an issue with contour shading? If you pick a point where you
>> know there is a value, is the output correct?
>> Andrew
>>
>> > On Oct 2, 2017, at 9:00 AM, Daniel Nairn <dannairn at gmail.com> wrote:
>> >
>> > Hello Andrew
>> >
>> > Yes I simplified the script as suggested at that does look much better,
>> thank you. Not quite sure what I've done wrong with the const loops though.
>> >
>> > On 1 October 2017 at 21:55, Andrew Friedman <andfried at gmail.com> wrote:
>> > Hi Daniel,
>> >
>> > What if you simplify it by just looking at the inner loop:
>> maskout(cape,myhel-100)? Does the output look correct? Then you can build
>> on it by adding the successive const loops.
>> >
>> > Andrew
>> >
>> > > On Oct 1, 2017, at 12:59 PM, Daniel Nairn <dannairn at gmail.com> wrote:
>> > >
>> > > Hello
>> > >
>> > > I am trying to plot a chart (from one ensemble member) that displays
>> SBCAPE where 0-1km helicity is greater than 100. This is how my current
>> script looks
>> > >
>> > > 'define cape = capesfc(e=2)'
>> > > 'define myhel = HLCY0_1000m(e=2)'
>> > > 'define capehel = const(const(maskout(cape,myhel-100),1),0.0,-u)'
>> > > 'd capehel'
>> > >
>> > > I'm not convinced this is correct as my final image output does not
>> show any CAPE values where expected. Can anybody help at all?
>> > >
>> > > _______________________________________________
>> > > 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
>> >
>> > _______________________________________________
>> > 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
>>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Post-doctoral research fellow
University of Oklahoma School of Meteorology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20171002/abd94d37/attachment.html 

------------------------------

_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr


End of gradsusr Digest, Vol 92, Issue 2
***************************************


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20171003/659dde6a/attachment-0001.html 


More information about the gradsusr mailing list