[gradsusr] [non-nasa source] Re: Plotting daily average

Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC] jennifer.m.adams at nasa.gov
Fri Apr 26 13:12:59 EDT 2019


Hi, Emily -- 
I just realized something about your descriptor file ... the XDEF and YDEF entries should have a size of 1. And your TDEF should have an increment of 1dy not 1hr. This dataset should be a 1D daily time series of global area averages, right? Your binary .dat file should be Tsize*4 bytes large. 

As for your script to create the daily averages, it looks okay, except for your expression inside the while loop  -- ave(tseries, time='d_start''timestring', time='d_end''timestringI')' -- I don't know what that looks like because those script variables are not set. And you've got your t=t+24 counter commented out. Stick with time axis indices instead of date strings for controlling the loop and inside your expression, it will make your code clearer.
--Jennifer


-- 
Jennifer Miletta Adams
ADNET Systems, Inc.
NASA/GSFC, Code 610.2
Building 32, Room S159
(301) 614-6070
 

On 4/25/19, 11:16 AM, "gradsusr on behalf of Saunders, Emily (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC]" <gradsusr-bounces at gradsusr.org on behalf of emily.saunders at nasa.gov> wrote:

    Hi Jennifer,
    
    I made the changes to the ctl file and it was able to open, but the script crashed when I tried to plot 
    
    Data Request Warning:  Request is completely outside file limits
    Low Level I/O Error:  Read error on data file 
      Data file name = /nfs3m/archive/sfa_cache04/users/g00/esaunde2/grads_scripts/scripts/GEOS_CF_Total/All_Species/dailymean_totcolco_2018.dat 
      Error reading 5760 bytes at location 143654400
    
    Here is the script that I used to create the daily means:
    'set time 'begintime' 'endtime
    'set z 1'
    'set lon 0'
    'set lat 0'
    'cons = 2.687e+20/6.022e+23*48/1.0e+12'
    'areaavg = tloop(aave(totcol_co,lon=0,lon=360,lat=-90,lat=90))'
    'define tseries = cons*areaavg*510.1*1000000000000'
    'set fwrite -ap dailymean_co_2018.dat'
    '!/bin/rm -f dailymean_co_2018.dat'
    'set gxout fwrite'
    t = begintime
    while (t<endtime)
       'set time 't
       'd ave(tseries, time='d_start''timestring', time='d_end''timestringI')'
    *   t = t+24
    endwhile
    'disable fwrite'
    begintime = start date (i.e. 20180101)
    endtime = end date (i.e. 20180131)
    timestring = 20180101
    timestringI = 20180131
    
    I am not sure if the script is actually creating the daily means and how would I know that means were created for each day.
    
    Thanks,
    
    Emily 
    
    On 4/25/19, 10:38 AM, "gradsusr on behalf of Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC]" <gradsusr-bounces at gradsusr.org on behalf of jennifer.m.adams at nasa.gov> wrote:
    
        Hi, Emily -- 
        Remove 'lon' from your XDEF entry, remove 'lat' from your YDEF entry, and remove 'time' from your TDEF entry. You will need to add entries 'ZDEF 1 linear 1 1' and 'UNDEF -9.99e8 and also a variable declaration 'varname 0 99 var description'. Then use the 'open' command instead of 'xdfopen'. 
        --Jennifer
        
        -- 
        Jennifer Miletta Adams
        ADNET Systems, Inc.
        NASA/GSFC, Code 610.2
        Building 32, Room S159
        (301) 614-6070
         
        
        On 4/25/19, 9:51 AM, "gradsusr on behalf of Saunders, Emily (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC]" <gradsusr-bounces at gradsusr.org on behalf of emily.saunders at nasa.gov> wrote:
        
            Hi Jennifer,
            
            I have a couple questions about your approach to create the daily means. I created a script that would create the daily means for all days in 2018, but I am unsure how to use the dailymean.dat file when creating the plot. I tried adding the .dat file to a ctl file, but I received the following error message: 
            
            "Error: nc_open failed to open file /nfs3m/archive/sfa_cache04/users/g00/esaunde2/grads_scripts/scripts/GEOS_CF_Total/All_Species/dailymean_totcolco_2018.dat
            NetCDF: Unknown file format
            gadsdf: Couldn't ingest SDF metadata.
            SDF Descriptor file GEOS_CF_hindcast_tavg1_2d_xgc_Nx_daily_totcolco.ctl was not successfully opened & parsed."
            
            Here is the format of the ctl file including the .dat file 
            "Dset/nfs3m/archive/sfa_cache04/users/g00/esaunde2/grads_scripts/scripts/GEOS_CF_Total/All_Species/dailymean_totcolco_2018.dat
            TITLE Daily Mean totcol_co Jan012018
            XDEF lon 1440 LINEAR -180.0 0.25
            YDEF lat 721 LINEAR  -90.0 0.25
            TDEF time 9000 LINEAR 00:30z01JAN2018 1hr"
            Is there a particular format to use when adding a .dat file to a ctl file or do I have to convert the .dat file to a netcdf format. 
            Thanks for your help in advance.
            
            
            Emily 
            
             
            
            On 3/4/19, 4:45 PM, "gradsusr on behalf of Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC]" <gradsusr-bounces at gradsusr.org on behalf of jennifer.m.adams at nasa.gov> wrote:
            
                Hi, Emily -- 
                If you want to convert a dataset that is hourly to one that is daily, you need to use fwrite (or sdfwrite) to build it explicitly. This is a bare-bones outline for what you need to do, my syntax is not guaranteed to work:
                
                tbeg=1
                tend=365
                'set t 'tbeg' 'tend
                areaavg = tloop(aave(var,g))   ;* define your hourly area average time series first, so you do the I/O only once
                'set fwrite -ap dailymean.dat' 
                '!/bin/rm -f dailymean.dat'    ;* make sure that dailymean.dat does not already exist
                'set gxout fwrite'
                t=tbeg
                while (t<tend)
                   'set t 't
                   'd ave(areaavg,t+0,t+23)    ;* this is the daily mean 
                   t=t+24
                endwhile
                'disable fwrite'
                
                
                -- 
                Jennifer Miletta Adams
                ADNET Systems, Inc.
                NASA/GSFC, Code 610.2
                Building 32, Room S159
                (301) 614-6070
                 
                
                On 3/4/19, 12:34 PM, "gradsusr on behalf of Saunders, Emily (GSFC-610.0)[SCIENCE SYSTEMS AND APPLICATIONS INC]" <gradsusr-bounces at gradsusr.org on behalf of emily.saunders at nasa.gov> wrote:
                
                    Hi all,
                    
                    I need some help plotting the daily average for the total CO burden. In 
                    my script I am trying to plot the calculated Total CO burden daily 
                    average and plot the daily average value for each day, but instead it 
                    plots the value for each hour instead of the average of the hours. Here 
                    is part of the script I am working with:
                    
                    'set time 01JAN2019
                    'set time 05JAN2019
                    'set z 1'
                    'set lon 0'
                    'set lat 0'
                    'set ccolor 14'
                    'set cstyle 1'
                    'set cthick 10'
                    'cons = 2.687e+20/6.022e+23*48/1.0e+12'
                    'define tseries = 
                    cons*aave(totcol_co,lon=0,lon=360,lat=-90,lat=90)*510.1*1000000000000'
                    'define a = ave(tseries, time=00:30z01JAN2019, time=23:30z05JAN2019)'
                    'set parea 1.5 9 1.5 7.5'
                    'set digsiz 0.10'
                    'set cmark 3'
                    'd a'
                    
                    Thank you for your help in advance.
                    
                    -- 
                    Emily Saunders, PhD.
                    Senior Research Scientist
                    Global Modeling and Assimilation Office/SSAI
                    NASA Goddard Space Flight Center Bldg 33, Room H-111B
                    Code 610.1, Greenbelt, MD, 20771
                    Phone: +1-301-614-6532
                    
                    _______________________________________________
                    gradsusr mailing list
                    gradsusr at gradsusr.org
                    https://urldefense.proofpoint.com/v2/url?u=http-3A__gradsusr.org_mailman_listinfo_gradsusr&d=DwICAg&c=ApwzowJNAKKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=M2mFZsxo0ZoztoK2Lyoypu1kKkBVKyEoM9CXGWO42zk&m=BqvJ1gpPp6UsVJ8xCQgeUVsTqQIUMaKSioEo-DIvRtA&s=iROw_ETmciLifggPzeiuiHIma3NfoWMm6wxnWw40Mds&e=
                    
                
                
                _______________________________________________
                gradsusr mailing list
                gradsusr at gradsusr.org
                https://urldefense.proofpoint.com/v2/url?u=http-3A__gradsusr.org_mailman_listinfo_gradsusr&d=DwIGaQ&c=ApwzowJNAKKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=-SHQ4f_MglXELUyjmwhuOCNwyN_2_7nEdE9kM7s5Wi0&m=EzYGKrT6gAONwIUhc3Eg38SRp7U9im6HuuZSF2wlmk0&s=oNBsdJCsYTwz2FRjhfF-c38tOjyIgHMbe3nga1GLvZY&e=
                
            
            
            _______________________________________________
            gradsusr mailing list
            gradsusr at gradsusr.org
            https://urldefense.proofpoint.com/v2/url?u=http-3A__gradsusr.org_mailman_listinfo_gradsusr&d=DwIGaQ&c=ApwzowJNAKKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=M2mFZsxo0ZoztoK2Lyoypu1kKkBVKyEoM9CXGWO42zk&m=IlQA3JsgZssAra41QJwUfgU9v7u1cEbrNjDYNHrBkfs&s=cTBDVMrtpj6mYB9H3hHSZrFMLaNOIYj_02lr7PTdmSw&e=
            
        
        
        _______________________________________________
        gradsusr mailing list
        gradsusr at gradsusr.org
        https://urldefense.proofpoint.com/v2/url?u=http-3A__gradsusr.org_mailman_listinfo_gradsusr&d=DwIGaQ&c=ApwzowJNAKKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=-SHQ4f_MglXELUyjmwhuOCNwyN_2_7nEdE9kM7s5Wi0&m=hRgK81wpxSWDT7sdaMbqnsn3xVSstDA-sTMlvmziiDE&s=D1amOiB8445ZRIwRGLrM4g6eZBqSdnbX-pqTzc3_5kc&e=
        
    
    
    _______________________________________________
    gradsusr mailing list
    gradsusr at gradsusr.org
    https://urldefense.proofpoint.com/v2/url?u=http-3A__gradsusr.org_mailman_listinfo_gradsusr&d=DwIGaQ&c=ApwzowJNAKKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=M2mFZsxo0ZoztoK2Lyoypu1kKkBVKyEoM9CXGWO42zk&m=JwzyOePLR9cDq5I2_kRXSfDEQOEaAyTt3c_-wfhWWto&s=0xP5kebsJRT9ilY01pEDHl_zELkHR6-DPl3FoG-wzWo&e=
    




More information about the gradsusr mailing list