Menu

Era-Interim masking help

Help
Karl
2017-07-10
2017-07-10
  • Karl

    Karl - 2017-07-10

    Hi I have two .nc files (a land-sea mask and rainfall both for era-interim).

    I am trying to calculate the time-series over a grid-box, however this grid-box includes the sea values as well which i do not want. To exclude the sea values i am trying to mask off all values over the sea, and have some difficulties in this aspect.

    What i've done so far:
    1) I removed a degenerate time dimension from the land-sea mask (the land-sea mask fron ERA-Interim only contains one variable 'lsm').
    2) Appended the land-sea mask into my rainfall data

    I've also ensure the latitude, longitude size of both files are the same, as well as their resolution.

    From here I am not sure of what i should do, in previous threads that i have looked, some have suggested using ncwa or ncap2. Any help and advice is appreciated!

     

    Last edit: Karl 2017-07-10
  • henry Butowsky

    henry Butowsky - 2017-07-10

    HI Karl,
    you are almost there --
    ill assume that rainfal var is "double pcp(time,lat,lon) " and that it has a missing_value or _FillValue
    and the land-sea mask is "int mask(lat,lon)" ( 1 is land , 0 is sea )

    /******* avg.nco*********/
      where( mask ==1 )
          pcp=pcp;
        elsewhere
          pcp=pcp.get_miss();
    
         pcp_avg=pcp.avg($lat,$lon); 
      /****************************/    
    

    to run the above script us ethe following command.

    ncap2 -v -O -S avg.nco in.nc out.nc

    ...Henry

     
  • Karl

    Karl - 2017-07-10

    Hi Henry, thank you for your reply.

    A quick ncdump on my rainfall data gave me:

        short tp(time, latitude, longitude) ;
                tp:scale_factor = 5.94397276467581e-06 ;
                tp:add_offset = 0.194760211607368 ;
                tp:_FillValue = -32767s ;
                tp:missing_value = -32767s ;
                tp:units = "m" ;
                tp:long_name = "Total precipitation" ;
        double lsm(latitude, longitude) ;
                lsm:_FillValue = -32767. ;
                lsm:missing_value = -32767s ;
                lsm:units = "(0 - 1)" ;
                lsm:long_name = "Land-sea mask" ;
                lsm:standard_name = "land_binary_mask" ;
    

    Would the above script still be applicable?

    Cheers

     
  • henry Butowsky

    henry Butowsky - 2017-07-10

    HI Karl,
    yep should still work -
    just change lat to latitude and lon to longitude.

    ...Henry

     
  • Karl

    Karl - 2017-07-10

    Hi Henry,

    i am receiving their error mssg after running ncaps2 line:
    avg.nco:2:15: expecting (, found '=='

    I am not sure what there error means..

    Karl

     
  • henry Butowsky

    henry Butowsky - 2017-07-10

    sorry mask is a function -use yor var name s in the script e.g

    /******* avg.nco*********/
      where( lsm ==1 )
          tp=tp;
        elsewhere
          tp=tp.get_miss();
    
         tp_avg=tp.avg($latitude,$longitude); 
      /****************************/
    
     

Log in to post a comment.