metno / emep-ctm

Open Source EMEP/MSC-W model
GNU General Public License v3.0
27 stars 18 forks source link

MET_inner and RUNDOMAIN_inner with WRF met files #27

Closed JohnJohanssonChalmers closed 6 years ago

JohnJohanssonChalmers commented 6 years ago

I'm running EMEP with WRF met files from two nested WRF domains. When running EMEP on the outer domain I tried to use the MET_inner and RUNDOMAIN_inner parameters. These are not documented in the user guide, but from reading the code I got the impression that EMEP would read the met file for the inner domain specified in MET_inner and together with RUNDOMAIN_inner automatically determine which cells it needs to save data from for the inner domain run.

However, this doesn't seem to work for me. I think the problem is that the code reading the relevant info from the inner domain met file is not adapted to read WRF met files. It seems to be looking for attributes and variables not present my WRF met files.

gitpeterwind commented 6 years ago

This option has not been much tested yet, so this might have several causes. Could you send us the error message? Did you run the outer (first) run using wrf metdata too? if you could send me (by mail peter.wind@met.no) the metadata of your wrf file that may help too (i.e. what you get when you run "ncdump -h wrf_dataXXX" where wrf_dataXXX is the file used for MET_inner)

JohnJohanssonChalmers commented 6 years ago

Here is error message including the output right before it:

 current date and time: 2013-08-01 00:20:00
 current date and time: 2013-08-01 00:40:00
 Nest:write data EMEP_grid1_20130801_OUT.nc
 init_mask_restrict: reading /misc/orsbackup/backup/Photosmog_China/modeling/simulations/WRF/runs/europe_test_2013/wrfout_d02_2013-07-25_00_00_00
 Nest: projection not found for /misc/orsbackup/backup/Photosmog_China/modeling/simulations/WRF/runs/europe_test_2013/wrfout_d02_2013-07-25_00_00_00, assuming lon lat
 CheckStopl_int2 Called with: int1          -46  int2            0
 STOP-ALL ERROR: Nest: i-dimension not found: /misc/orsbackup/backup/Photosmog_China/modeling/simulations/WRF/runs/europe_test_2013/wrfout_d02_2013-07-25_00_00_00. Include new name in init_nest_restrict
application called MPI_Abort(MPI_COMM_WORLD, 9) - process 0

===================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   EXIT CODE: 9
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================

Yes, both the outer and the inner domain are run with WRF metdata. The metdata comes from a nested WRF simulation. I've used WRF settings that I got from Massimo, so I believe the output should be suitable for EMEP. Maybe I should ask him for some advice too. Just to be clear though: this is the outer run. The metdata for the inner run is only included to figure out which cells in the grid to save for the inner run, right?

Here is the output from ncdump:

netcdf wrfout_d02_2013-08-02_00_00_00 {
dimensions:
    Time = UNLIMITED ; // (24 currently)
    DateStrLen = 19 ;
    west_east = 198 ;
    south_north = 99 ;
    bottom_top = 21 ;
    bottom_top_stag = 22 ;
    soil_layers_stag = 4 ;
    west_east_stag = 199 ;
    south_north_stag = 100 ;
variables:
    char Times(Time, DateStrLen) ;
    float XLAT(Time, south_north, west_east) ;
        XLAT:FieldType = 104 ;
        XLAT:MemoryOrder = "XY " ;
        XLAT:description = "LATITUDE, SOUTH IS NEGATIVE" ;
        XLAT:units = "degree_north" ;
        XLAT:stagger = "" ;
        XLAT:coordinates = "XLONG XLAT" ;
    float XLONG(Time, south_north, west_east) ;
        XLONG:FieldType = 104 ;
        XLONG:MemoryOrder = "XY " ;
        XLONG:description = "LONGITUDE, WEST IS NEGATIVE" ;
        XLONG:units = "degree_east" ;
        XLONG:stagger = "" ;
        XLONG:coordinates = "XLONG XLAT" ;
    float LU_INDEX(Time, south_north, west_east) ;
        LU_INDEX:FieldType = 104 ;
        LU_INDEX:MemoryOrder = "XY " ;
        LU_INDEX:description = "LAND USE CATEGORY" ;
        LU_INDEX:units = "" ;
        LU_INDEX:stagger = "" ;
        LU_INDEX:coordinates = "XLONG XLAT XTIME" ;
    float ZNU(Time, bottom_top) ;
        ZNU:FieldType = 104 ;
        ZNU:MemoryOrder = "Z  " ;
        ZNU:description = "eta values on half (mass) levels" ;
        ZNU:units = "" ;
        ZNU:stagger = "" ;
    float ZNW(Time, bottom_top_stag) ;
        ZNW:FieldType = 104 ;
        ZNW:MemoryOrder = "Z  " ;
        ZNW:description = "eta values on full (w) levels" ;
        ZNW:units = "" ;
        ZNW:stagger = "Z" ;
    float ZS(Time, soil_layers_stag) ;
        ZS:FieldType = 104 ;
        ZS:MemoryOrder = "Z  " ;
        ZS:description = "DEPTHS OF CENTERS OF SOIL LAYERS" ;
        ZS:units = "m" ;
        ZS:stagger = "Z" ;
    float DZS(Time, soil_layers_stag) ;
        DZS:FieldType = 104 ;
        DZS:MemoryOrder = "Z  " ;
        DZS:description = "THICKNESSES OF SOIL LAYERS" ;
        DZS:units = "m" ;
        DZS:stagger = "Z" ;
    float VAR_SSO(Time, south_north, west_east) ;
        VAR_SSO:FieldType = 104 ;
        VAR_SSO:MemoryOrder = "XY " ;
        VAR_SSO:description = "variance of subgrid-scale orography" ;
        VAR_SSO:units = "m2" ;
        VAR_SSO:stagger = "" ;
        VAR_SSO:coordinates = "XLONG XLAT XTIME" ;
    float U(Time, bottom_top, south_north, west_east_stag) ;
        U:FieldType = 104 ;
        U:MemoryOrder = "XYZ" ;
        U:description = "x-wind component" ;
        U:units = "m s-1" ;
        U:stagger = "X" ;
        U:coordinates = "XLONG_U XLAT_U XTIME" ;
    float V(Time, bottom_top, south_north_stag, west_east) ;
        V:FieldType = 104 ;
        V:MemoryOrder = "XYZ" ;
        V:description = "y-wind component" ;
        V:units = "m s-1" ;
        V:stagger = "Y" ;
        V:coordinates = "XLONG_V XLAT_V XTIME" ;
    float W(Time, bottom_top_stag, south_north, west_east) ;
        W:FieldType = 104 ;
        W:MemoryOrder = "XYZ" ;
        W:description = "z-wind component" ;
        W:units = "m s-1" ;
        W:stagger = "Z" ;
        W:coordinates = "XLONG XLAT XTIME" ;
    float PH(Time, bottom_top_stag, south_north, west_east) ;
        PH:FieldType = 104 ;
        PH:MemoryOrder = "XYZ" ;
        PH:description = "perturbation geopotential" ;
        PH:units = "m2 s-2" ;
        PH:stagger = "Z" ;
        PH:coordinates = "XLONG XLAT XTIME" ;
    float PHB(Time, bottom_top_stag, south_north, west_east) ;
        PHB:FieldType = 104 ;
        PHB:MemoryOrder = "XYZ" ;
        PHB:description = "base-state geopotential" ;
        PHB:units = "m2 s-2" ;
        PHB:stagger = "Z" ;
        PHB:coordinates = "XLONG XLAT XTIME" ;
    float T(Time, bottom_top, south_north, west_east) ;
        T:FieldType = 104 ;
        T:MemoryOrder = "XYZ" ;
        T:description = "perturbation potential temperature (theta-t0)" ;
        T:units = "K" ;
        T:stagger = "" ;
        T:coordinates = "XLONG XLAT XTIME" ;
    float HFX_FORCE(Time) ;
        HFX_FORCE:FieldType = 104 ;
        HFX_FORCE:MemoryOrder = "0  " ;
        HFX_FORCE:description = "SCM ideal surface sensible heat flux" ;
        HFX_FORCE:units = "W m-2" ;
        HFX_FORCE:stagger = "" ;
    float LH_FORCE(Time) ;
        LH_FORCE:FieldType = 104 ;
        LH_FORCE:MemoryOrder = "0  " ;
        LH_FORCE:description = "SCM ideal surface latent heat flux" ;
        LH_FORCE:units = "W m-2" ;
        LH_FORCE:stagger = "" ;
    float TSK_FORCE(Time) ;
        TSK_FORCE:FieldType = 104 ;
        TSK_FORCE:MemoryOrder = "0  " ;
        TSK_FORCE:description = "SCM ideal surface skin temperature" ;
        TSK_FORCE:units = "W m-2" ;
        TSK_FORCE:stagger = "" ;
    float HFX_FORCE_TEND(Time) ;
        HFX_FORCE_TEND:FieldType = 104 ;
        HFX_FORCE_TEND:MemoryOrder = "0  " ;
        HFX_FORCE_TEND:description = "SCM ideal surface sensible heat flux tendency" ;
        HFX_FORCE_TEND:units = "W m-2 s-1" ;
        HFX_FORCE_TEND:stagger = "" ;
    float LH_FORCE_TEND(Time) ;
        LH_FORCE_TEND:FieldType = 104 ;
        LH_FORCE_TEND:MemoryOrder = "0  " ;
        LH_FORCE_TEND:description = "SCM ideal surface latent heat flux tendency" ;
        LH_FORCE_TEND:units = "W m-2 s-1" ;
        LH_FORCE_TEND:stagger = "" ;
    float TSK_FORCE_TEND(Time) ;
        TSK_FORCE_TEND:FieldType = 104 ;
        TSK_FORCE_TEND:MemoryOrder = "0  " ;
        TSK_FORCE_TEND:description = "SCM ideal surface skin temperature tendency" ;
        TSK_FORCE_TEND:units = "W m-2 s-1" ;
        TSK_FORCE_TEND:stagger = "" ;
    float MU(Time, south_north, west_east) ;
        MU:FieldType = 104 ;
        MU:MemoryOrder = "XY " ;
        MU:description = "perturbation dry air mass in column" ;
        MU:units = "Pa" ;
        MU:stagger = "" ;
        MU:coordinates = "XLONG XLAT XTIME" ;
    float MUB(Time, south_north, west_east) ;
        MUB:FieldType = 104 ;
        MUB:MemoryOrder = "XY " ;
        MUB:description = "base state dry air mass in column" ;
        MUB:units = "Pa" ;
        MUB:stagger = "" ;
        MUB:coordinates = "XLONG XLAT XTIME" ;
    float NEST_POS(Time, south_north, west_east) ;
        NEST_POS:FieldType = 104 ;
        NEST_POS:MemoryOrder = "XY " ;
        NEST_POS:description = "-" ;
        NEST_POS:units = "-" ;
        NEST_POS:stagger = "" ;
        NEST_POS:coordinates = "XLONG XLAT XTIME" ;
    float P(Time, bottom_top, south_north, west_east) ;
        P:FieldType = 104 ;
        P:MemoryOrder = "XYZ" ;
        P:description = "perturbation pressure" ;
        P:units = "Pa" ;
        P:stagger = "" ;
        P:coordinates = "XLONG XLAT XTIME" ;
    float PB(Time, bottom_top, south_north, west_east) ;
        PB:FieldType = 104 ;
        PB:MemoryOrder = "XYZ" ;
        PB:description = "BASE STATE PRESSURE" ;
        PB:units = "Pa" ;
        PB:stagger = "" ;
        PB:coordinates = "XLONG XLAT XTIME" ;
    float FNM(Time, bottom_top) ;
        FNM:FieldType = 104 ;
        FNM:MemoryOrder = "Z  " ;
        FNM:description = "upper weight for vertical stretching" ;
        FNM:units = "" ;
        FNM:stagger = "" ;
    float FNP(Time, bottom_top) ;
        FNP:FieldType = 104 ;
        FNP:MemoryOrder = "Z  " ;
        FNP:description = "lower weight for vertical stretching" ;
        FNP:units = "" ;
        FNP:stagger = "" ;
    float RDNW(Time, bottom_top) ;
        RDNW:FieldType = 104 ;
        RDNW:MemoryOrder = "Z  " ;
        RDNW:description = "inverse d(eta) values between full (w) levels" ;
        RDNW:units = "" ;
        RDNW:stagger = "" ;
    float RDN(Time, bottom_top) ;
        RDN:FieldType = 104 ;
        RDN:MemoryOrder = "Z  " ;
        RDN:description = "inverse d(eta) values between half (mass) levels" ;
        RDN:units = "" ;
        RDN:stagger = "" ;
    float DNW(Time, bottom_top) ;
        DNW:FieldType = 104 ;
        DNW:MemoryOrder = "Z  " ;
        DNW:description = "d(eta) values between full (w) levels" ;
        DNW:units = "" ;
        DNW:stagger = "" ;
    float DN(Time, bottom_top) ;
        DN:FieldType = 104 ;
        DN:MemoryOrder = "Z  " ;
        DN:description = "d(eta) values between half (mass) levels" ;
        DN:units = "" ;
        DN:stagger = "" ;
    float CFN(Time) ;
        CFN:FieldType = 104 ;
        CFN:MemoryOrder = "0  " ;
        CFN:description = "extrapolation constant" ;
        CFN:units = "" ;
        CFN:stagger = "" ;
    float CFN1(Time) ;
        CFN1:FieldType = 104 ;
        CFN1:MemoryOrder = "0  " ;
        CFN1:description = "extrapolation constant" ;
        CFN1:units = "" ;
        CFN1:stagger = "" ;
    int THIS_IS_AN_IDEAL_RUN(Time) ;
        THIS_IS_AN_IDEAL_RUN:FieldType = 106 ;
        THIS_IS_AN_IDEAL_RUN:MemoryOrder = "0  " ;
        THIS_IS_AN_IDEAL_RUN:description = "T/F flag: this is an ARW ideal simulation" ;
        THIS_IS_AN_IDEAL_RUN:units = "-" ;
        THIS_IS_AN_IDEAL_RUN:stagger = "" ;
    float P_HYD(Time, bottom_top, south_north, west_east) ;
        P_HYD:FieldType = 104 ;
        P_HYD:MemoryOrder = "XYZ" ;
        P_HYD:description = "hydrostatic pressure" ;
        P_HYD:units = "Pa" ;
        P_HYD:stagger = "" ;
        P_HYD:coordinates = "XLONG XLAT XTIME" ;
    float Q2(Time, south_north, west_east) ;
        Q2:FieldType = 104 ;
        Q2:MemoryOrder = "XY " ;
        Q2:description = "QV at 2 M" ;
        Q2:units = "kg kg-1" ;
        Q2:stagger = "" ;
        Q2:coordinates = "XLONG XLAT XTIME" ;
    float T2(Time, south_north, west_east) ;
        T2:FieldType = 104 ;
        T2:MemoryOrder = "XY " ;
        T2:description = "TEMP at 2 M" ;
        T2:units = "K" ;
        T2:stagger = "" ;
        T2:coordinates = "XLONG XLAT XTIME" ;
    float TH2(Time, south_north, west_east) ;
        TH2:FieldType = 104 ;
        TH2:MemoryOrder = "XY " ;
        TH2:description = "POT TEMP at 2 M" ;
        TH2:units = "K" ;
        TH2:stagger = "" ;
        TH2:coordinates = "XLONG XLAT XTIME" ;
    float PSFC(Time, south_north, west_east) ;
        PSFC:FieldType = 104 ;
        PSFC:MemoryOrder = "XY " ;
        PSFC:description = "SFC PRESSURE" ;
        PSFC:units = "Pa" ;
        PSFC:stagger = "" ;
        PSFC:coordinates = "XLONG XLAT XTIME" ;
    float U10(Time, south_north, west_east) ;
        U10:FieldType = 104 ;
        U10:MemoryOrder = "XY " ;
        U10:description = "U at 10 M" ;
        U10:units = "m s-1" ;
        U10:stagger = "" ;
        U10:coordinates = "XLONG XLAT XTIME" ;
    float V10(Time, south_north, west_east) ;
        V10:FieldType = 104 ;
        V10:MemoryOrder = "XY " ;
        V10:description = "V at 10 M" ;
        V10:units = "m s-1" ;
        V10:stagger = "" ;
        V10:coordinates = "XLONG XLAT XTIME" ;
    float RDX(Time) ;
        RDX:FieldType = 104 ;
        RDX:MemoryOrder = "0  " ;
        RDX:description = "INVERSE X GRID LENGTH" ;
        RDX:units = "" ;
        RDX:stagger = "" ;
    float RDY(Time) ;
        RDY:FieldType = 104 ;
        RDY:MemoryOrder = "0  " ;
        RDY:description = "INVERSE Y GRID LENGTH" ;
        RDY:units = "" ;
        RDY:stagger = "" ;
    float RESM(Time) ;
        RESM:FieldType = 104 ;
        RESM:MemoryOrder = "0  " ;
        RESM:description = "TIME WEIGHT CONSTANT FOR SMALL STEPS" ;
        RESM:units = "" ;
        RESM:stagger = "" ;
    float ZETATOP(Time) ;
        ZETATOP:FieldType = 104 ;
        ZETATOP:MemoryOrder = "0  " ;
        ZETATOP:description = "ZETA AT MODEL TOP" ;
        ZETATOP:units = "" ;
        ZETATOP:stagger = "" ;
    float CF1(Time) ;
        CF1:FieldType = 104 ;
        CF1:MemoryOrder = "0  " ;
        CF1:description = "2nd order extrapolation constant" ;
        CF1:units = "" ;
        CF1:stagger = "" ;
    float CF2(Time) ;
        CF2:FieldType = 104 ;
        CF2:MemoryOrder = "0  " ;
        CF2:description = "2nd order extrapolation constant" ;
        CF2:units = "" ;
        CF2:stagger = "" ;
    float CF3(Time) ;
        CF3:FieldType = 104 ;
        CF3:MemoryOrder = "0  " ;
        CF3:description = "2nd order extrapolation constant" ;
        CF3:units = "" ;
        CF3:stagger = "" ;
    int ITIMESTEP(Time) ;
        ITIMESTEP:FieldType = 106 ;
        ITIMESTEP:MemoryOrder = "0  " ;
        ITIMESTEP:description = "" ;
        ITIMESTEP:units = "" ;
        ITIMESTEP:stagger = "" ;
    float XTIME(Time) ;
        XTIME:FieldType = 104 ;
        XTIME:MemoryOrder = "0  " ;
        XTIME:description = "minutes since 2013-07-25 00:00:00" ;
        XTIME:units = "minutes since 2013-07-25 00:00:00" ;
        XTIME:stagger = "" ;
    float QVAPOR(Time, bottom_top, south_north, west_east) ;
        QVAPOR:FieldType = 104 ;
        QVAPOR:MemoryOrder = "XYZ" ;
        QVAPOR:description = "Water vapor mixing ratio" ;
        QVAPOR:units = "kg kg-1" ;
        QVAPOR:stagger = "" ;
        QVAPOR:coordinates = "XLONG XLAT XTIME" ;
    float QCLOUD(Time, bottom_top, south_north, west_east) ;
        QCLOUD:FieldType = 104 ;
        QCLOUD:MemoryOrder = "XYZ" ;
        QCLOUD:description = "Cloud water mixing ratio" ;
        QCLOUD:units = "kg kg-1" ;
        QCLOUD:stagger = "" ;
        QCLOUD:coordinates = "XLONG XLAT XTIME" ;
    float QRAIN(Time, bottom_top, south_north, west_east) ;
        QRAIN:FieldType = 104 ;
        QRAIN:MemoryOrder = "XYZ" ;
        QRAIN:description = "Rain water mixing ratio" ;
        QRAIN:units = "kg kg-1" ;
        QRAIN:stagger = "" ;
        QRAIN:coordinates = "XLONG XLAT XTIME" ;
    float QICE(Time, bottom_top, south_north, west_east) ;
        QICE:FieldType = 104 ;
        QICE:MemoryOrder = "XYZ" ;
        QICE:description = "Ice mixing ratio" ;
        QICE:units = "kg kg-1" ;
        QICE:stagger = "" ;
        QICE:coordinates = "XLONG XLAT XTIME" ;
    float QSNOW(Time, bottom_top, south_north, west_east) ;
        QSNOW:FieldType = 104 ;
        QSNOW:MemoryOrder = "XYZ" ;
        QSNOW:description = "Snow mixing ratio" ;
        QSNOW:units = "kg kg-1" ;
        QSNOW:stagger = "" ;
        QSNOW:coordinates = "XLONG XLAT XTIME" ;
    float QGRAUP(Time, bottom_top, south_north, west_east) ;
        QGRAUP:FieldType = 104 ;
        QGRAUP:MemoryOrder = "XYZ" ;
        QGRAUP:description = "Graupel mixing ratio" ;
        QGRAUP:units = "kg kg-1" ;
        QGRAUP:stagger = "" ;
        QGRAUP:coordinates = "XLONG XLAT XTIME" ;
    float SHDMAX(Time, south_north, west_east) ;
        SHDMAX:FieldType = 104 ;
        SHDMAX:MemoryOrder = "XY " ;
        SHDMAX:description = "ANNUAL MAX VEG FRACTION" ;
        SHDMAX:units = "" ;
        SHDMAX:stagger = "" ;
        SHDMAX:coordinates = "XLONG XLAT XTIME" ;
    float SHDMIN(Time, south_north, west_east) ;
        SHDMIN:FieldType = 104 ;
        SHDMIN:MemoryOrder = "XY " ;
        SHDMIN:description = "ANNUAL MIN VEG FRACTION" ;
        SHDMIN:units = "" ;
        SHDMIN:stagger = "" ;
        SHDMIN:coordinates = "XLONG XLAT XTIME" ;
    float SNOALB(Time, south_north, west_east) ;
        SNOALB:FieldType = 104 ;
        SNOALB:MemoryOrder = "XY " ;
        SNOALB:description = "ANNUAL MAX SNOW ALBEDO IN FRACTION" ;
        SNOALB:units = "" ;
        SNOALB:stagger = "" ;
        SNOALB:coordinates = "XLONG XLAT XTIME" ;
    float TSLB(Time, soil_layers_stag, south_north, west_east) ;
        TSLB:FieldType = 104 ;
        TSLB:MemoryOrder = "XYZ" ;
        TSLB:description = "SOIL TEMPERATURE" ;
        TSLB:units = "K" ;
        TSLB:stagger = "Z" ;
        TSLB:coordinates = "XLONG XLAT XTIME" ;
    float SMOIS(Time, soil_layers_stag, south_north, west_east) ;
        SMOIS:FieldType = 104 ;
        SMOIS:MemoryOrder = "XYZ" ;
        SMOIS:description = "SOIL MOISTURE" ;
        SMOIS:units = "m3 m-3" ;
        SMOIS:stagger = "Z" ;
        SMOIS:coordinates = "XLONG XLAT XTIME" ;
    float SH2O(Time, soil_layers_stag, south_north, west_east) ;
        SH2O:FieldType = 104 ;
        SH2O:MemoryOrder = "XYZ" ;
        SH2O:description = "SOIL LIQUID WATER" ;
        SH2O:units = "m3 m-3" ;
        SH2O:stagger = "Z" ;
        SH2O:coordinates = "XLONG XLAT XTIME" ;
    float SMCREL(Time, soil_layers_stag, south_north, west_east) ;
        SMCREL:FieldType = 104 ;
        SMCREL:MemoryOrder = "XYZ" ;
        SMCREL:description = "RELATIVE SOIL MOISTURE" ;
        SMCREL:units = "" ;
        SMCREL:stagger = "Z" ;
        SMCREL:coordinates = "XLONG XLAT XTIME" ;
    float SEAICE(Time, south_north, west_east) ;
        SEAICE:FieldType = 104 ;
        SEAICE:MemoryOrder = "XY " ;
        SEAICE:description = "SEA ICE FLAG" ;
        SEAICE:units = "" ;
        SEAICE:stagger = "" ;
        SEAICE:coordinates = "XLONG XLAT XTIME" ;
    float XICEM(Time, south_north, west_east) ;
        XICEM:FieldType = 104 ;
        XICEM:MemoryOrder = "XY " ;
        XICEM:description = "SEA ICE FLAG (PREVIOUS STEP)" ;
        XICEM:units = "" ;
        XICEM:stagger = "" ;
        XICEM:coordinates = "XLONG XLAT XTIME" ;
    float SFROFF(Time, south_north, west_east) ;
        SFROFF:FieldType = 104 ;
        SFROFF:MemoryOrder = "XY " ;
        SFROFF:description = "SURFACE RUNOFF" ;
        SFROFF:units = "mm" ;
        SFROFF:stagger = "" ;
        SFROFF:coordinates = "XLONG XLAT XTIME" ;
    float UDROFF(Time, south_north, west_east) ;
        UDROFF:FieldType = 104 ;
        UDROFF:MemoryOrder = "XY " ;
        UDROFF:description = "UNDERGROUND RUNOFF" ;
        UDROFF:units = "mm" ;
        UDROFF:stagger = "" ;
        UDROFF:coordinates = "XLONG XLAT XTIME" ;
    int IVGTYP(Time, south_north, west_east) ;
        IVGTYP:FieldType = 106 ;
        IVGTYP:MemoryOrder = "XY " ;
        IVGTYP:description = "DOMINANT VEGETATION CATEGORY" ;
        IVGTYP:units = "" ;
        IVGTYP:stagger = "" ;
        IVGTYP:coordinates = "XLONG XLAT XTIME" ;
    int ISLTYP(Time, south_north, west_east) ;
        ISLTYP:FieldType = 106 ;
        ISLTYP:MemoryOrder = "XY " ;
        ISLTYP:description = "DOMINANT SOIL CATEGORY" ;
        ISLTYP:units = "" ;
        ISLTYP:stagger = "" ;
        ISLTYP:coordinates = "XLONG XLAT XTIME" ;
    float VEGFRA(Time, south_north, west_east) ;
        VEGFRA:FieldType = 104 ;
        VEGFRA:MemoryOrder = "XY " ;
        VEGFRA:description = "VEGETATION FRACTION" ;
        VEGFRA:units = "" ;
        VEGFRA:stagger = "" ;
        VEGFRA:coordinates = "XLONG XLAT XTIME" ;
    float GRDFLX(Time, south_north, west_east) ;
        GRDFLX:FieldType = 104 ;
        GRDFLX:MemoryOrder = "XY " ;
        GRDFLX:description = "GROUND HEAT FLUX" ;
        GRDFLX:units = "W m-2" ;
        GRDFLX:stagger = "" ;
        GRDFLX:coordinates = "XLONG XLAT XTIME" ;
    float ACGRDFLX(Time, south_north, west_east) ;
        ACGRDFLX:FieldType = 104 ;
        ACGRDFLX:MemoryOrder = "XY " ;
        ACGRDFLX:description = "ACCUMULATED GROUND HEAT FLUX" ;
        ACGRDFLX:units = "J m-2" ;
        ACGRDFLX:stagger = "" ;
        ACGRDFLX:coordinates = "XLONG XLAT XTIME" ;
    float ACSNOM(Time, south_north, west_east) ;
        ACSNOM:FieldType = 104 ;
        ACSNOM:MemoryOrder = "XY " ;
        ACSNOM:description = "ACCUMULATED MELTED SNOW" ;
        ACSNOM:units = "kg m-2" ;
        ACSNOM:stagger = "" ;
        ACSNOM:coordinates = "XLONG XLAT XTIME" ;
    float SNOW(Time, south_north, west_east) ;
        SNOW:FieldType = 104 ;
        SNOW:MemoryOrder = "XY " ;
        SNOW:description = "SNOW WATER EQUIVALENT" ;
        SNOW:units = "kg m-2" ;
        SNOW:stagger = "" ;
        SNOW:coordinates = "XLONG XLAT XTIME" ;
    float SNOWH(Time, south_north, west_east) ;
        SNOWH:FieldType = 104 ;
        SNOWH:MemoryOrder = "XY " ;
        SNOWH:description = "PHYSICAL SNOW DEPTH" ;
        SNOWH:units = "m" ;
        SNOWH:stagger = "" ;
        SNOWH:coordinates = "XLONG XLAT XTIME" ;
    float CANWAT(Time, south_north, west_east) ;
        CANWAT:FieldType = 104 ;
        CANWAT:MemoryOrder = "XY " ;
        CANWAT:description = "CANOPY WATER" ;
        CANWAT:units = "kg m-2" ;
        CANWAT:stagger = "" ;
        CANWAT:coordinates = "XLONG XLAT XTIME" ;
    float SSTSK(Time, south_north, west_east) ;
        SSTSK:FieldType = 104 ;
        SSTSK:MemoryOrder = "XY " ;
        SSTSK:description = "SKIN SEA SURFACE TEMPERATURE" ;
        SSTSK:units = "K" ;
        SSTSK:stagger = "" ;
        SSTSK:coordinates = "XLONG XLAT XTIME" ;
    float COSZEN(Time, south_north, west_east) ;
        COSZEN:FieldType = 104 ;
        COSZEN:MemoryOrder = "XY " ;
        COSZEN:description = "COS of SOLAR ZENITH ANGLE" ;
        COSZEN:units = "dimensionless" ;
        COSZEN:stagger = "" ;
        COSZEN:coordinates = "XLONG XLAT XTIME" ;
    float LAI(Time, south_north, west_east) ;
        LAI:FieldType = 104 ;
        LAI:MemoryOrder = "XY " ;
        LAI:description = "LEAF AREA INDEX" ;
        LAI:units = "m-2/m-2" ;
        LAI:stagger = "" ;
        LAI:coordinates = "XLONG XLAT XTIME" ;
    float VAR(Time, south_north, west_east) ;
        VAR:FieldType = 104 ;
        VAR:MemoryOrder = "XY " ;
        VAR:description = "OROGRAPHIC VARIANCE" ;
        VAR:units = "" ;
        VAR:stagger = "" ;
        VAR:coordinates = "XLONG XLAT XTIME" ;
    float MAPFAC_M(Time, south_north, west_east) ;
        MAPFAC_M:FieldType = 104 ;
        MAPFAC_M:MemoryOrder = "XY " ;
        MAPFAC_M:description = "Map scale factor on mass grid" ;
        MAPFAC_M:units = "" ;
        MAPFAC_M:stagger = "" ;
        MAPFAC_M:coordinates = "XLONG XLAT XTIME" ;
    float MAPFAC_U(Time, south_north, west_east_stag) ;
        MAPFAC_U:FieldType = 104 ;
        MAPFAC_U:MemoryOrder = "XY " ;
        MAPFAC_U:description = "Map scale factor on u-grid" ;
        MAPFAC_U:units = "" ;
        MAPFAC_U:stagger = "X" ;
        MAPFAC_U:coordinates = "XLONG_U XLAT_U XTIME" ;
    float MAPFAC_V(Time, south_north_stag, west_east) ;
        MAPFAC_V:FieldType = 104 ;
        MAPFAC_V:MemoryOrder = "XY " ;
        MAPFAC_V:description = "Map scale factor on v-grid" ;
        MAPFAC_V:units = "" ;
        MAPFAC_V:stagger = "Y" ;
        MAPFAC_V:coordinates = "XLONG_V XLAT_V XTIME" ;
    float MAPFAC_MX(Time, south_north, west_east) ;
        MAPFAC_MX:FieldType = 104 ;
        MAPFAC_MX:MemoryOrder = "XY " ;
        MAPFAC_MX:description = "Map scale factor on mass grid, x direction" ;
        MAPFAC_MX:units = "" ;
        MAPFAC_MX:stagger = "" ;
        MAPFAC_MX:coordinates = "XLONG XLAT XTIME" ;
    float MAPFAC_MY(Time, south_north, west_east) ;
        MAPFAC_MY:FieldType = 104 ;
        MAPFAC_MY:MemoryOrder = "XY " ;
        MAPFAC_MY:description = "Map scale factor on mass grid, y direction" ;
        MAPFAC_MY:units = "" ;
        MAPFAC_MY:stagger = "" ;
        MAPFAC_MY:coordinates = "XLONG XLAT XTIME" ;
    float MAPFAC_UX(Time, south_north, west_east_stag) ;
        MAPFAC_UX:FieldType = 104 ;
        MAPFAC_UX:MemoryOrder = "XY " ;
        MAPFAC_UX:description = "Map scale factor on u-grid, x direction" ;
        MAPFAC_UX:units = "" ;
        MAPFAC_UX:stagger = "X" ;
        MAPFAC_UX:coordinates = "XLONG_U XLAT_U XTIME" ;
    float MAPFAC_UY(Time, south_north, west_east_stag) ;
        MAPFAC_UY:FieldType = 104 ;
        MAPFAC_UY:MemoryOrder = "XY " ;
        MAPFAC_UY:description = "Map scale factor on u-grid, y direction" ;
        MAPFAC_UY:units = "" ;
        MAPFAC_UY:stagger = "X" ;
        MAPFAC_UY:coordinates = "XLONG_U XLAT_U XTIME" ;
    float MAPFAC_VX(Time, south_north_stag, west_east) ;
        MAPFAC_VX:FieldType = 104 ;
        MAPFAC_VX:MemoryOrder = "XY " ;
        MAPFAC_VX:description = "Map scale factor on v-grid, x direction" ;
        MAPFAC_VX:units = "" ;
        MAPFAC_VX:stagger = "Y" ;
        MAPFAC_VX:coordinates = "XLONG_V XLAT_V XTIME" ;
    float MF_VX_INV(Time, south_north_stag, west_east) ;
        MF_VX_INV:FieldType = 104 ;
        MF_VX_INV:MemoryOrder = "XY " ;
        MF_VX_INV:description = "Inverse map scale factor on v-grid, x direction" ;
        MF_VX_INV:units = "" ;
        MF_VX_INV:stagger = "Y" ;
        MF_VX_INV:coordinates = "XLONG_V XLAT_V XTIME" ;
    float MAPFAC_VY(Time, south_north_stag, west_east) ;
        MAPFAC_VY:FieldType = 104 ;
        MAPFAC_VY:MemoryOrder = "XY " ;
        MAPFAC_VY:description = "Map scale factor on v-grid, y direction" ;
        MAPFAC_VY:units = "" ;
        MAPFAC_VY:stagger = "Y" ;
        MAPFAC_VY:coordinates = "XLONG_V XLAT_V XTIME" ;
    float F(Time, south_north, west_east) ;
        F:FieldType = 104 ;
        F:MemoryOrder = "XY " ;
        F:description = "Coriolis sine latitude term" ;
        F:units = "s-1" ;
        F:stagger = "" ;
        F:coordinates = "XLONG XLAT XTIME" ;
    float E(Time, south_north, west_east) ;
        E:FieldType = 104 ;
        E:MemoryOrder = "XY " ;
        E:description = "Coriolis cosine latitude term" ;
        E:units = "s-1" ;
        E:stagger = "" ;
        E:coordinates = "XLONG XLAT XTIME" ;
    float SINALPHA(Time, south_north, west_east) ;
        SINALPHA:FieldType = 104 ;
        SINALPHA:MemoryOrder = "XY " ;
        SINALPHA:description = "Local sine of map rotation" ;
        SINALPHA:units = "" ;
        SINALPHA:stagger = "" ;
        SINALPHA:coordinates = "XLONG XLAT XTIME" ;
    float COSALPHA(Time, south_north, west_east) ;
        COSALPHA:FieldType = 104 ;
        COSALPHA:MemoryOrder = "XY " ;
        COSALPHA:description = "Local cosine of map rotation" ;
        COSALPHA:units = "" ;
        COSALPHA:stagger = "" ;
        COSALPHA:coordinates = "XLONG XLAT XTIME" ;
    float HGT(Time, south_north, west_east) ;
        HGT:FieldType = 104 ;
        HGT:MemoryOrder = "XY " ;
        HGT:description = "Terrain Height" ;
        HGT:units = "m" ;
        HGT:stagger = "" ;
        HGT:coordinates = "XLONG XLAT XTIME" ;
    float TSK(Time, south_north, west_east) ;
        TSK:FieldType = 104 ;
        TSK:MemoryOrder = "XY " ;
        TSK:description = "SURFACE SKIN TEMPERATURE" ;
        TSK:units = "K" ;
        TSK:stagger = "" ;
        TSK:coordinates = "XLONG XLAT XTIME" ;
    float P_TOP(Time) ;
        P_TOP:FieldType = 104 ;
        P_TOP:MemoryOrder = "0  " ;
        P_TOP:description = "PRESSURE TOP OF THE MODEL" ;
        P_TOP:units = "Pa" ;
        P_TOP:stagger = "" ;
    float T00(Time) ;
        T00:FieldType = 104 ;
        T00:MemoryOrder = "0  " ;
        T00:description = "BASE STATE TEMPERATURE" ;
        T00:units = "K" ;
        T00:stagger = "" ;
    float P00(Time) ;
        P00:FieldType = 104 ;
        P00:MemoryOrder = "0  " ;
        P00:description = "BASE STATE PRESURE" ;
        P00:units = "Pa" ;
        P00:stagger = "" ;
    float TLP(Time) ;
        TLP:FieldType = 104 ;
        TLP:MemoryOrder = "0  " ;
        TLP:description = "BASE STATE LAPSE RATE" ;
        TLP:units = "" ;
        TLP:stagger = "" ;
    float TISO(Time) ;
        TISO:FieldType = 104 ;
        TISO:MemoryOrder = "0  " ;
        TISO:description = "TEMP AT WHICH THE BASE T TURNS CONST" ;
        TISO:units = "K" ;
        TISO:stagger = "" ;
    float TLP_STRAT(Time) ;
        TLP_STRAT:FieldType = 104 ;
        TLP_STRAT:MemoryOrder = "0  " ;
        TLP_STRAT:description = "BASE STATE LAPSE RATE (DT/D(LN(P)) IN STRATOSPHERE" ;
        TLP_STRAT:units = "K" ;
        TLP_STRAT:stagger = "" ;
    float P_STRAT(Time) ;
        P_STRAT:FieldType = 104 ;
        P_STRAT:MemoryOrder = "0  " ;
        P_STRAT:description = "BASE STATE PRESSURE AT BOTTOM OF STRATOSPHERE" ;
        P_STRAT:units = "Pa" ;
        P_STRAT:stagger = "" ;
    float MAX_MSTFX(Time) ;
        MAX_MSTFX:FieldType = 104 ;
        MAX_MSTFX:MemoryOrder = "0  " ;
        MAX_MSTFX:description = "Max map factor in domain" ;
        MAX_MSTFX:units = "" ;
        MAX_MSTFX:stagger = "" ;
    float MAX_MSTFY(Time) ;
        MAX_MSTFY:FieldType = 104 ;
        MAX_MSTFY:MemoryOrder = "0  " ;
        MAX_MSTFY:description = "Max map factor in domain" ;
        MAX_MSTFY:units = "" ;
        MAX_MSTFY:stagger = "" ;
    float RAINC(Time, south_north, west_east) ;
        RAINC:FieldType = 104 ;
        RAINC:MemoryOrder = "XY " ;
        RAINC:description = "ACCUMULATED TOTAL CUMULUS PRECIPITATION" ;
        RAINC:units = "mm" ;
        RAINC:stagger = "" ;
        RAINC:coordinates = "XLONG XLAT XTIME" ;
    float RAINSH(Time, south_north, west_east) ;
        RAINSH:FieldType = 104 ;
        RAINSH:MemoryOrder = "XY " ;
        RAINSH:description = "ACCUMULATED SHALLOW CUMULUS PRECIPITATION" ;
        RAINSH:units = "mm" ;
        RAINSH:stagger = "" ;
        RAINSH:coordinates = "XLONG XLAT XTIME" ;
    float RAINNC(Time, south_north, west_east) ;
        RAINNC:FieldType = 104 ;
        RAINNC:MemoryOrder = "XY " ;
        RAINNC:description = "ACCUMULATED TOTAL GRID SCALE PRECIPITATION" ;
        RAINNC:units = "mm" ;
        RAINNC:stagger = "" ;
        RAINNC:coordinates = "XLONG XLAT XTIME" ;
    float SNOWNC(Time, south_north, west_east) ;
        SNOWNC:FieldType = 104 ;
        SNOWNC:MemoryOrder = "XY " ;
        SNOWNC:description = "ACCUMULATED TOTAL GRID SCALE SNOW AND ICE" ;
        SNOWNC:units = "mm" ;
        SNOWNC:stagger = "" ;
        SNOWNC:coordinates = "XLONG XLAT XTIME" ;
    float GRAUPELNC(Time, south_north, west_east) ;
        GRAUPELNC:FieldType = 104 ;
        GRAUPELNC:MemoryOrder = "XY " ;
        GRAUPELNC:description = "ACCUMULATED TOTAL GRID SCALE GRAUPEL" ;
        GRAUPELNC:units = "mm" ;
        GRAUPELNC:stagger = "" ;
        GRAUPELNC:coordinates = "XLONG XLAT XTIME" ;
    float HAILNC(Time, south_north, west_east) ;
        HAILNC:FieldType = 104 ;
        HAILNC:MemoryOrder = "XY " ;
        HAILNC:description = "ACCUMULATED TOTAL GRID SCALE HAIL" ;
        HAILNC:units = "mm" ;
        HAILNC:stagger = "" ;
        HAILNC:coordinates = "XLONG XLAT XTIME" ;
    float CLDFRA(Time, bottom_top, south_north, west_east) ;
        CLDFRA:FieldType = 104 ;
        CLDFRA:MemoryOrder = "XYZ" ;
        CLDFRA:description = "CLOUD FRACTION" ;
        CLDFRA:units = "" ;
        CLDFRA:stagger = "" ;
        CLDFRA:coordinates = "XLONG XLAT XTIME" ;
    float SWDOWN(Time, south_north, west_east) ;
        SWDOWN:FieldType = 104 ;
        SWDOWN:MemoryOrder = "XY " ;
        SWDOWN:description = "DOWNWARD SHORT WAVE FLUX AT GROUND SURFACE" ;
        SWDOWN:units = "W m-2" ;
        SWDOWN:stagger = "" ;
        SWDOWN:coordinates = "XLONG XLAT XTIME" ;
    float GLW(Time, south_north, west_east) ;
        GLW:FieldType = 104 ;
        GLW:MemoryOrder = "XY " ;
        GLW:description = "DOWNWARD LONG WAVE FLUX AT GROUND SURFACE" ;
        GLW:units = "W m-2" ;
        GLW:stagger = "" ;
        GLW:coordinates = "XLONG XLAT XTIME" ;
    float SWNORM(Time, south_north, west_east) ;
        SWNORM:FieldType = 104 ;
        SWNORM:MemoryOrder = "XY " ;
        SWNORM:description = "NORMAL SHORT WAVE FLUX AT GROUND SURFACE (SLOPE-DEPENDENT)" ;
        SWNORM:units = "W m-2" ;
        SWNORM:stagger = "" ;
        SWNORM:coordinates = "XLONG XLAT XTIME" ;
    float OLR(Time, south_north, west_east) ;
        OLR:FieldType = 104 ;
        OLR:MemoryOrder = "XY " ;
        OLR:description = "TOA OUTGOING LONG WAVE" ;
        OLR:units = "W m-2" ;
        OLR:stagger = "" ;
        OLR:coordinates = "XLONG XLAT XTIME" ;
    float XLAT_U(Time, south_north, west_east_stag) ;
        XLAT_U:FieldType = 104 ;
        XLAT_U:MemoryOrder = "XY " ;
        XLAT_U:description = "LATITUDE, SOUTH IS NEGATIVE" ;
        XLAT_U:units = "degree_north" ;
        XLAT_U:stagger = "X" ;
        XLAT_U:coordinates = "XLONG_U XLAT_U" ;
    float XLONG_U(Time, south_north, west_east_stag) ;
        XLONG_U:FieldType = 104 ;
        XLONG_U:MemoryOrder = "XY " ;
        XLONG_U:description = "LONGITUDE, WEST IS NEGATIVE" ;
        XLONG_U:units = "degree_east" ;
        XLONG_U:stagger = "X" ;
        XLONG_U:coordinates = "XLONG_U XLAT_U" ;
    float XLAT_V(Time, south_north_stag, west_east) ;
        XLAT_V:FieldType = 104 ;
        XLAT_V:MemoryOrder = "XY " ;
        XLAT_V:description = "LATITUDE, SOUTH IS NEGATIVE" ;
        XLAT_V:units = "degree_north" ;
        XLAT_V:stagger = "Y" ;
        XLAT_V:coordinates = "XLONG_V XLAT_V" ;
    float XLONG_V(Time, south_north_stag, west_east) ;
        XLONG_V:FieldType = 104 ;
        XLONG_V:MemoryOrder = "XY " ;
        XLONG_V:description = "LONGITUDE, WEST IS NEGATIVE" ;
        XLONG_V:units = "degree_east" ;
        XLONG_V:stagger = "Y" ;
        XLONG_V:coordinates = "XLONG_V XLAT_V" ;
    float ALBEDO(Time, south_north, west_east) ;
        ALBEDO:FieldType = 104 ;
        ALBEDO:MemoryOrder = "XY " ;
        ALBEDO:description = "ALBEDO" ;
        ALBEDO:units = "-" ;
        ALBEDO:stagger = "" ;
        ALBEDO:coordinates = "XLONG XLAT XTIME" ;
    float CLAT(Time, south_north, west_east) ;
        CLAT:FieldType = 104 ;
        CLAT:MemoryOrder = "XY " ;
        CLAT:description = "COMPUTATIONAL GRID LATITUDE, SOUTH IS NEGATIVE" ;
        CLAT:units = "degree_north" ;
        CLAT:stagger = "" ;
        CLAT:coordinates = "XLONG XLAT XTIME" ;
    float ALBBCK(Time, south_north, west_east) ;
        ALBBCK:FieldType = 104 ;
        ALBBCK:MemoryOrder = "XY " ;
        ALBBCK:description = "BACKGROUND ALBEDO" ;
        ALBBCK:units = "" ;
        ALBBCK:stagger = "" ;
        ALBBCK:coordinates = "XLONG XLAT XTIME" ;
    float EMISS(Time, south_north, west_east) ;
        EMISS:FieldType = 104 ;
        EMISS:MemoryOrder = "XY " ;
        EMISS:description = "SURFACE EMISSIVITY" ;
        EMISS:units = "" ;
        EMISS:stagger = "" ;
        EMISS:coordinates = "XLONG XLAT XTIME" ;
    float NOAHRES(Time, south_north, west_east) ;
        NOAHRES:FieldType = 104 ;
        NOAHRES:MemoryOrder = "XY " ;
        NOAHRES:description = "RESIDUAL OF THE NOAH SURFACE ENERGY BUDGET" ;
        NOAHRES:units = "W m{-2}" ;
        NOAHRES:stagger = "" ;
        NOAHRES:coordinates = "XLONG XLAT XTIME" ;
    float TMN(Time, south_north, west_east) ;
        TMN:FieldType = 104 ;
        TMN:MemoryOrder = "XY " ;
        TMN:description = "SOIL TEMPERATURE AT LOWER BOUNDARY" ;
        TMN:units = "K" ;
        TMN:stagger = "" ;
        TMN:coordinates = "XLONG XLAT XTIME" ;
    float XLAND(Time, south_north, west_east) ;
        XLAND:FieldType = 104 ;
        XLAND:MemoryOrder = "XY " ;
        XLAND:description = "LAND MASK (1 FOR LAND, 2 FOR WATER)" ;
        XLAND:units = "" ;
        XLAND:stagger = "" ;
        XLAND:coordinates = "XLONG XLAT XTIME" ;
    float UST(Time, south_north, west_east) ;
        UST:FieldType = 104 ;
        UST:MemoryOrder = "XY " ;
        UST:description = "U* IN SIMILARITY THEORY" ;
        UST:units = "m s-1" ;
        UST:stagger = "" ;
        UST:coordinates = "XLONG XLAT XTIME" ;
    float PBLH(Time, south_north, west_east) ;
        PBLH:FieldType = 104 ;
        PBLH:MemoryOrder = "XY " ;
        PBLH:description = "PBL HEIGHT" ;
        PBLH:units = "m" ;
        PBLH:stagger = "" ;
        PBLH:coordinates = "XLONG XLAT XTIME" ;
    float HFX(Time, south_north, west_east) ;
        HFX:FieldType = 104 ;
        HFX:MemoryOrder = "XY " ;
        HFX:description = "UPWARD HEAT FLUX AT THE SURFACE" ;
        HFX:units = "W m-2" ;
        HFX:stagger = "" ;
        HFX:coordinates = "XLONG XLAT XTIME" ;
    float QFX(Time, south_north, west_east) ;
        QFX:FieldType = 104 ;
        QFX:MemoryOrder = "XY " ;
        QFX:description = "UPWARD MOISTURE FLUX AT THE SURFACE" ;
        QFX:units = "kg m-2 s-1" ;
        QFX:stagger = "" ;
        QFX:coordinates = "XLONG XLAT XTIME" ;
    float LH(Time, south_north, west_east) ;
        LH:FieldType = 104 ;
        LH:MemoryOrder = "XY " ;
        LH:description = "LATENT HEAT FLUX AT THE SURFACE" ;
        LH:units = "W m-2" ;
        LH:stagger = "" ;
        LH:coordinates = "XLONG XLAT XTIME" ;
    float ACHFX(Time, south_north, west_east) ;
        ACHFX:FieldType = 104 ;
        ACHFX:MemoryOrder = "XY " ;
        ACHFX:description = "ACCUMULATED UPWARD HEAT FLUX AT THE SURFACE" ;
        ACHFX:units = "J m-2" ;
        ACHFX:stagger = "" ;
        ACHFX:coordinates = "XLONG XLAT XTIME" ;
    float ACLHF(Time, south_north, west_east) ;
        ACLHF:FieldType = 104 ;
        ACLHF:MemoryOrder = "XY " ;
        ACLHF:description = "ACCUMULATED UPWARD LATENT HEAT FLUX AT THE SURFACE" ;
        ACLHF:units = "J m-2" ;
        ACLHF:stagger = "" ;
        ACLHF:coordinates = "XLONG XLAT XTIME" ;
    float SNOWC(Time, south_north, west_east) ;
        SNOWC:FieldType = 104 ;
        SNOWC:MemoryOrder = "XY " ;
        SNOWC:description = "FLAG INDICATING SNOW COVERAGE (1 FOR SNOW COVER)" ;
        SNOWC:units = "" ;
        SNOWC:stagger = "" ;
        SNOWC:coordinates = "XLONG XLAT XTIME" ;
    float SR(Time, south_north, west_east) ;
        SR:FieldType = 104 ;
        SR:MemoryOrder = "XY " ;
        SR:description = "fraction of frozen precipitation" ;
        SR:units = "-" ;
        SR:stagger = "" ;
        SR:coordinates = "XLONG XLAT XTIME" ;
    int SAVE_TOPO_FROM_REAL(Time) ;
        SAVE_TOPO_FROM_REAL:FieldType = 106 ;
        SAVE_TOPO_FROM_REAL:MemoryOrder = "0  " ;
        SAVE_TOPO_FROM_REAL:description = "1=original topo from real/0=topo modified by WRF" ;
        SAVE_TOPO_FROM_REAL:units = "flag" ;
        SAVE_TOPO_FROM_REAL:stagger = "" ;
    float HFX_FDDA(Time, bottom_top, south_north, west_east) ;
        HFX_FDDA:FieldType = 104 ;
        HFX_FDDA:MemoryOrder = "XYZ" ;
        HFX_FDDA:description = "PSEUDO RADIATIVE HEAT FLUX FROM TEMPERATURE FDDA" ;
        HFX_FDDA:units = "W m-2" ;
        HFX_FDDA:stagger = "" ;
        HFX_FDDA:coordinates = "XLONG XLAT XTIME" ;
    int ISEEDARR_SPPT(Time, bottom_top) ;
        ISEEDARR_SPPT:FieldType = 106 ;
        ISEEDARR_SPPT:MemoryOrder = "Z  " ;
        ISEEDARR_SPPT:description = "Array to hold seed for restart, SPPT" ;
        ISEEDARR_SPPT:units = "" ;
        ISEEDARR_SPPT:stagger = "" ;
    int ISEEDARR_SKEBS(Time, bottom_top) ;
        ISEEDARR_SKEBS:FieldType = 106 ;
        ISEEDARR_SKEBS:MemoryOrder = "Z  " ;
        ISEEDARR_SKEBS:description = "Array to hold seed for restart, SKEBS" ;
        ISEEDARR_SKEBS:units = "" ;
        ISEEDARR_SKEBS:stagger = "" ;
    int ISEEDARR_RAND_PERTURB(Time, bottom_top) ;
        ISEEDARR_RAND_PERTURB:FieldType = 106 ;
        ISEEDARR_RAND_PERTURB:MemoryOrder = "Z  " ;
        ISEEDARR_RAND_PERTURB:description = "Array to hold seed for restart, RAND_PERT" ;
        ISEEDARR_RAND_PERTURB:units = "" ;
        ISEEDARR_RAND_PERTURB:stagger = "" ;
    int ISEEDARRAY_SPP_CONV(Time, bottom_top) ;
        ISEEDARRAY_SPP_CONV:FieldType = 106 ;
        ISEEDARRAY_SPP_CONV:MemoryOrder = "Z  " ;
        ISEEDARRAY_SPP_CONV:description = "Array to hold seed for restart, RAND_PERT2" ;
        ISEEDARRAY_SPP_CONV:units = "" ;
        ISEEDARRAY_SPP_CONV:stagger = "" ;
    int ISEEDARRAY_SPP_PBL(Time, bottom_top) ;
        ISEEDARRAY_SPP_PBL:FieldType = 106 ;
        ISEEDARRAY_SPP_PBL:MemoryOrder = "Z  " ;
        ISEEDARRAY_SPP_PBL:description = "Array to hold seed for restart, RAND_PERT3" ;
        ISEEDARRAY_SPP_PBL:units = "" ;
        ISEEDARRAY_SPP_PBL:stagger = "" ;
    int ISEEDARRAY_SPP_LSM(Time, bottom_top) ;
        ISEEDARRAY_SPP_LSM:FieldType = 106 ;
        ISEEDARRAY_SPP_LSM:MemoryOrder = "Z  " ;
        ISEEDARRAY_SPP_LSM:description = "Array to hold seed for restart, RAND_PERT4" ;
        ISEEDARRAY_SPP_LSM:units = "" ;
        ISEEDARRAY_SPP_LSM:stagger = "" ;
    float BF(Time, bottom_top_stag) ;
        BF:FieldType = 104 ;
        BF:MemoryOrder = "Z  " ;
        BF:description = "full levels, bf=0 => isobaric; bf=znw => sigma" ;
        BF:units = "Dimensionless" ;
        BF:stagger = "Z" ;
    float C1H(Time, bottom_top) ;
        C1H:FieldType = 104 ;
        C1H:MemoryOrder = "Z  " ;
        C1H:description = "half levels, c1h = d bf / d eta, using znw" ;
        C1H:units = "Dimensionless" ;
        C1H:stagger = "" ;
    float C2H(Time, bottom_top) ;
        C2H:FieldType = 104 ;
        C2H:MemoryOrder = "Z  " ;
        C2H:description = "half levels, c2h = (1-c1h)*(p0-pt)" ;
        C2H:units = "Pa" ;
        C2H:stagger = "" ;
    float BH(Time, bottom_top) ;
        BH:FieldType = 104 ;
        BH:MemoryOrder = "Z  " ;
        BH:description = "half levels, bh=0 => isobaric; bh=znu => sigma" ;
        BH:units = "Dimensionless" ;
        BH:stagger = "" ;
    float C1F(Time, bottom_top_stag) ;
        C1F:FieldType = 104 ;
        C1F:MemoryOrder = "Z  " ;
        C1F:description = "full levels, c1f = d bf / d eta, using znu" ;
        C1F:units = "Dimensionless" ;
        C1F:stagger = "Z" ;
    float C2F(Time, bottom_top_stag) ;
        C2F:FieldType = 104 ;
        C2F:MemoryOrder = "Z  " ;
        C2F:description = "full levels, c2f = (1-c1f)*(p0-pt)" ;
        C2F:units = "Pa" ;
        C2F:stagger = "Z" ;
    float C3H(Time, bottom_top) ;
        C3H:FieldType = 104 ;
        C3H:MemoryOrder = "Z  " ;
        C3H:description = "half levels, c3h = bh" ;
        C3H:units = "Dimensionless" ;
        C3H:stagger = "" ;
    float C4H(Time, bottom_top) ;
        C4H:FieldType = 104 ;
        C4H:MemoryOrder = "Z  " ;
        C4H:description = "half levels, c4h = (eta-bh)*(p0-pt)+pt, using znu" ;
        C4H:units = "Pa" ;
        C4H:stagger = "" ;
    float C3F(Time, bottom_top_stag) ;
        C3F:FieldType = 104 ;
        C3F:MemoryOrder = "Z  " ;
        C3F:description = "full levels, c3f = bf" ;
        C3F:units = "Dimensionless" ;
        C3F:stagger = "Z" ;
    float C4F(Time, bottom_top_stag) ;
        C4F:FieldType = 104 ;
        C4F:MemoryOrder = "Z  " ;
        C4F:description = "full levels, c4f = (eta-bf)*(p0-pt)+pt, using znw" ;
        C4F:units = "Pa" ;
        C4F:stagger = "Z" ;
    float PCB(Time, south_north, west_east) ;
        PCB:FieldType = 104 ;
        PCB:MemoryOrder = "XY " ;
        PCB:description = "base state dry air mass in column" ;
        PCB:units = "Pa" ;
        PCB:stagger = "" ;
        PCB:coordinates = "XLONG XLAT XTIME" ;
    float PC(Time, south_north, west_east) ;
        PC:FieldType = 104 ;
        PC:MemoryOrder = "XY " ;
        PC:description = "perturbation dry air mass in column" ;
        PC:units = "Pa" ;
        PC:stagger = "" ;
        PC:coordinates = "XLONG XLAT XTIME" ;
    float LANDMASK(Time, south_north, west_east) ;
        LANDMASK:FieldType = 104 ;
        LANDMASK:MemoryOrder = "XY " ;
        LANDMASK:description = "LAND MASK (1 FOR LAND, 0 FOR WATER)" ;
        LANDMASK:units = "" ;
        LANDMASK:stagger = "" ;
        LANDMASK:coordinates = "XLONG XLAT XTIME" ;
    float LAKEMASK(Time, south_north, west_east) ;
        LAKEMASK:FieldType = 104 ;
        LAKEMASK:MemoryOrder = "XY " ;
        LAKEMASK:description = "LAKE MASK (1 FOR LAKE, 0 FOR NON-LAKE)" ;
        LAKEMASK:units = "" ;
        LAKEMASK:stagger = "" ;
        LAKEMASK:coordinates = "XLONG XLAT XTIME" ;
    float SST(Time, south_north, west_east) ;
        SST:FieldType = 104 ;
        SST:MemoryOrder = "XY " ;
        SST:description = "SEA SURFACE TEMPERATURE" ;
        SST:units = "K" ;
        SST:stagger = "" ;
        SST:coordinates = "XLONG XLAT XTIME" ;
    float SST_INPUT(Time, south_north, west_east) ;
        SST_INPUT:FieldType = 104 ;
        SST_INPUT:MemoryOrder = "XY " ;
        SST_INPUT:description = "SEA SURFACE TEMPERATURE FROM WRFLOWINPUT FILE" ;
        SST_INPUT:units = "K" ;
        SST_INPUT:stagger = "" ;
        SST_INPUT:coordinates = "XLONG XLAT XTIME" ;

// global attributes:
        :TITLE = " OUTPUT FROM WRF V3.9.1.1 MODEL" ;
        :START_DATE = "2013-07-25_00:00:00" ;
        :SIMULATION_START_DATE = "2013-07-25_00:00:00" ;
        :WEST-EAST_GRID_DIMENSION = 199 ;
        :SOUTH-NORTH_GRID_DIMENSION = 100 ;
        :BOTTOM-TOP_GRID_DIMENSION = 22 ;
        :DX = 18529.58f ;
        :DY = 18529.58f ;
        :SKEBS_ON = 0 ;
        :SPEC_BDY_FINAL_MU = 1 ;
        :USE_Q_DIABATIC = 0 ;
        :GRIDTYPE = "C" ;
        :DIFF_OPT = 1 ;
        :KM_OPT = 4 ;
        :DAMP_OPT = 0 ;
        :DAMPCOEF = 0.2f ;
        :KHDIF = 0.f ;
        :KVDIF = 0.f ;
        :MP_PHYSICS = 2 ;
        :RA_LW_PHYSICS = 1 ;
        :RA_SW_PHYSICS = 1 ;
        :SF_SFCLAY_PHYSICS = 1 ;
        :SF_SURFACE_PHYSICS = 2 ;
        :BL_PBL_PHYSICS = 1 ;
        :CU_PHYSICS = 99 ;
        :SF_LAKE_PHYSICS = 0 ;
        :SURFACE_INPUT_SOURCE = 3 ;
        :SST_UPDATE = 0 ;
        :GRID_FDDA = 1 ;
        :GFDDA_INTERVAL_M = 360 ;
        :GFDDA_END_H = 8760 ;
        :GRID_SFDDA = 0 ;
        :SGFDDA_INTERVAL_M = 0 ;
        :SGFDDA_END_H = 0 ;
        :HYPSOMETRIC_OPT = 2 ;
        :USE_THETA_M = 0 ;
        :GWD_OPT = 0 ;
        :SF_URBAN_PHYSICS = 0 ;
        :SF_OCEAN_PHYSICS = 0 ;
        :SHCU_PHYSICS = 0 ;
        :MFSHCONV = 0 ;
        :FEEDBACK = 0 ;
        :SMOOTH_OPTION = 2 ;
        :SWRAD_SCAT = 1.f ;
        :W_DAMPING = 0 ;
        :DT = 40.f ;
        :RADT = 30.f ;
        :BLDT = 0.f ;
        :CUDT = 5.f ;
        :AER_OPT = 0 ;
        :SWINT_OPT = 0 ;
        :AER_TYPE = 1 ;
        :AER_AOD550_OPT = 1 ;
        :AER_ANGEXP_OPT = 1 ;
        :AER_SSA_OPT = 1 ;
        :AER_ASY_OPT = 1 ;
        :AER_AOD550_VAL = 0.12f ;
        :AER_ANGEXP_VAL = 1.3f ;
        :AER_SSA_VAL = 0.85f ;
        :AER_ASY_VAL = 0.9f ;
        :MOIST_ADV_OPT = 1 ;
        :SCALAR_ADV_OPT = 1 ;
        :TKE_ADV_OPT = 1 ;
        :DIFF_6TH_OPT = 0 ;
        :DIFF_6TH_FACTOR = 0.12f ;
        :FGDT = 0.f ;
        :GUV = 0.0003f ;
        :GT = 0.0003f ;
        :GQ = 0.f ;
        :IF_RAMPING = 1 ;
        :DTRAMP_MIN = 60.f ;
        :OBS_NUDGE_OPT = 0 ;
        :BUCKET_MM = -1.f ;
        :BUCKET_J = -1.f ;
        :PREC_ACC_DT = 0.f ;
        :ISFTCFLX = 0 ;
        :ISHALLOW = 0 ;
        :ISFFLX = 1 ;
        :ICLOUD = 1 ;
        :ICLOUD_CU = 0 ;
        :TRACER_PBLMIX = 1 ;
        :SCALAR_PBLMIX = 0 ;
        :YSU_TOPDOWN_PBLMIX = 0 ;
        :GRAV_SETTLING = 0 ;
        :DFI_OPT = 0 ;
        :SIMULATION_INITIALIZATION_TYPE = "REAL-DATA CASE" ;
        :WEST-EAST_PATCH_START_UNSTAG = 1 ;
        :WEST-EAST_PATCH_END_UNSTAG = 198 ;
        :WEST-EAST_PATCH_START_STAG = 1 ;
        :WEST-EAST_PATCH_END_STAG = 199 ;
        :SOUTH-NORTH_PATCH_START_UNSTAG = 1 ;
        :SOUTH-NORTH_PATCH_END_UNSTAG = 99 ;
        :SOUTH-NORTH_PATCH_START_STAG = 1 ;
        :SOUTH-NORTH_PATCH_END_STAG = 100 ;
        :BOTTOM-TOP_PATCH_START_UNSTAG = 1 ;
        :BOTTOM-TOP_PATCH_END_UNSTAG = 21 ;
        :BOTTOM-TOP_PATCH_START_STAG = 1 ;
        :BOTTOM-TOP_PATCH_END_STAG = 22 ;
        :GRID_ID = 2 ;
        :PARENT_ID = 1 ;
        :I_PARENT_START = 39 ;
        :J_PARENT_START = 25 ;
        :PARENT_GRID_RATIO = 3 ;
        :CEN_LAT = 51.25f ;
        :CEN_LON = 8.f ;
        :TRUELAT1 = 1.e+20f ;
        :TRUELAT2 = 1.e+20f ;
        :MOAD_CEN_LAT = 52.f ;
        :STAND_LON = 1.f ;
        :POLE_LAT = 90.f ;
        :POLE_LON = 0.f ;
        :GMT = 0.f ;
        :JULYR = 2013 ;
        :JULDAY = 206 ;
        :MAP_PROJ = 6 ;
        :MAP_PROJ_CHAR = "Cylindrical Equidistant" ;
        :MMINLU = "MODIFIED_IGBP_MODIS_NOAH" ;
        :NUM_LAND_CAT = 20 ;
        :ISWATER = 17 ;
        :ISLAKE = -1 ;
        :ISICE = 15 ;
        :ISURBAN = 13 ;
        :ISOILWATER = 14 ;
        :HYBRID_OPT = -1 ;
        :ETAC = 0.f ;
}
gitpeterwind commented 6 years ago

This option was actually not compatible with wrf metdata. I have made some updates and tested with a wrf file. Could you try to replace (in Nest_ml.f90, line 1033) the routine "init_mask_restrict" with:

!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
subroutine init_mask_restrict(filename_read,rundomain_ext)

  !find lon and lat of boundaries of grid and build mask_restrict
  integer,intent(inout) ::rundomain_ext(4)
  character(len=*),intent(in) :: filename_read
  integer ::GIMAX_ext,GJMAX_ext
  integer :: ncFileID,varid,status
  integer :: i,j,n
  real, allocatable, dimension(:,:) ::lon_ext,lat_ext
  real, allocatable, dimension(:) :: temp_ll
  character(len=80) ::projection,iDName,jDName
  real, allocatable, dimension(:,:) ::Weight_rstrct,glon_rundom,glat_rundom
  integer, allocatable, dimension(:,:) ::IIij_rstrct,JJij_rstrct
  real, allocatable, dimension(:) ::lon_rstrct,lat_rstrct
  integer :: N_rstrct_BC,n4,N_rstrct_BC_per_proc

  allocate(mask_restrict(limax,ljmax))

  !Read dimensions (global)
  if(me==0)then
     status = nf90_open(trim(filename_read),nf90_nowrite,ncFileID)
     if(status/=nf90_noerr) then
        print *,'init_mask_restrict: not found',trim(filename_read)      
     else
        MASK_SET = .true.
        print *,'init_mask_restrict: reading ',trim(filename_read)

        projection='Unknown'
        status = nf90_get_att(ncFileID,nf90_global,"projection",projection)
        if(status==nf90_noerr) then
           if(projection=='lon_lat')projection='lon lat'
           write(*,*)'Nest: projection: '//trim(projection)
        else
           projection='lon lat'
           write(*,*)'Nest: projection not found for ',&
                trim(filename_read)//', assuming '//trim(projection)
        end if
        !get dimensions id/name/len: include more dimension names, if necessary
        GIMAX_ext=get_dimLen([character(len=12)::"i","lon","longitude","west_east"],name=iDName)
        GJMAX_ext=get_dimLen([character(len=12)::"j","lat","latitude","south_north" ],name=jDName)

        select case(projection)
        case('Stereographic')
           call CheckStop("i",iDName,"Nest: unsuported "//&
                trim(iDName)//" as i-dimension on "//trim(projection)//" projection")
           call CheckStop("j",jDName,"Nest: unsuported "//&
                trim(jDName)//" as j-dimension on "//trim(projection)//" projection")
        case('lon lat')
           if(trim(iDName)=='west_east')then!wrf metdata
              iDName='XLONG'
              write(*,*)'assuming ',trim(iDName)//' as longitude variable'
           endif
           if(trim(jDName)=='south_north')then!wrf metdata
              jDName='XLAT'
              write(*,*)'assuming ',trim(jDName)//' as latitude variable'
           endif
        case default
           !call CheckStop("Nest: unsuported projection "//trim(projection))
           !write(*,*)'GENERAL PROJECTION ',trim(projection)
           call CheckStop("i",iDName,"Nest: unsuported "//&
                trim(iDName)//" as i-dimension on "//trim(projection)//" projection")
           call CheckStop("j",jDName,"Nest: unsuported "//&
                trim(jDName)//" as j-dimension on "//trim(projection)//" projection")
        end select

        write(*,*)'Nest: dimensions inner grid',GIMAX_ext,GJMAX_ext

     end if
  end if

  CALL MPI_BCAST(MASK_SET,1,MPI_LOGICAL,0,MPI_COMM_CALC,IERROR)
  if (.not.MASK_SET)then
     deallocate(mask_restrict)
     return
  endif

  if(me==0)then
     allocate(lon_ext(GIMAX_ext,GJMAX_ext),lat_ext(GIMAX_ext,GJMAX_ext))
     !Read lon lat of the external grid (global)
     if(trim(projection)==trim('lon lat')) then
        if(trim(iDName)=='XLONG')then
           !wrf metdata
           call check(nf90_inq_varid(ncFileID,trim(iDName),varID),"dim:"//trim(iDName))
           call check(nf90_get_var(ncFileID,varID,lon_ext),"get:lon")

           call check(nf90_inq_varid(ncFileID,trim(jDName),varID),"dim:"//trim(jDName))
           call check(nf90_get_var(ncFileID,varID,lat_ext),"get:lat")
        else
           call check(nf90_inq_varid(ncFileID,iDName,varID),&
                "Read lon-variable: "//trim(iDName))
           allocate(temp_ll(GIMAX_ext))
           call check(nf90_get_var(ncFileID,varID,temp_ll))
           lon_ext=SPREAD(temp_ll,2,GJMAX_ext)
           deallocate(temp_ll)
           call check(nf90_inq_varid(ncFileID,jDName,varID),&
                "Read lat-variable: "//trim(jDName))
           allocate(temp_ll(GJMAX_ext))
           call check(nf90_get_var(ncFileID,varID,temp_ll))
           lat_ext=SPREAD(temp_ll,1,GIMAX_ext)
           deallocate(temp_ll)
        endif
     else
        call check(nf90_inq_varid(ncFileID,"lon",varID),"dim:lon")
        call check(nf90_get_var(ncFileID,varID,lon_ext),"get:lon")

        call check(nf90_inq_varid(ncFileID,"lat",varID),"dim:lat")
        call check(nf90_get_var(ncFileID,varID,lat_ext),"get:lat")
     end if

     call check(nf90_close(ncFileID))

     !N_rstrct_BC = number of points on boundaries in the inner grid 
     if(rundomain_ext(1)<1)rundomain_ext(1)=1
     if(rundomain_ext(2)<1 .or. rundomain_ext(2)>GIMAX_ext) rundomain_ext(2)=GIMAX_ext
     if(rundomain_ext(3)<1)rundomain_ext(3)=1
     if(rundomain_ext(4)<1 .or. rundomain_ext(4)>GJMAX_ext) rundomain_ext(4)=GJMAX_ext
     N_rstrct_BC=2*(rundomain_ext(2)-rundomain_ext(1)+1)+2*(rundomain_ext(4)-rundomain_ext(3)-1)
    N_rstrct_BC=2*(rundomain_ext(2)-rundomain_ext(1)+1)+2*(rundomain_ext(4)-rundomain_ext(3)-1)
     allocate(lon_rstrct(N_rstrct_BC))
     allocate(lat_rstrct(N_rstrct_BC))

     !take out only boundary cells
     N_rstrct_BC=0
     j=rundomain_ext(3)
     do i=rundomain_ext(1),rundomain_ext(2)
        N_rstrct_BC = N_rstrct_BC + 1
        lon_rstrct(N_rstrct_BC)=lon_ext(i,j)
        lat_rstrct(N_rstrct_BC)=lat_ext(i,j)
     enddo
     j=rundomain_ext(4)
     do i=rundomain_ext(1),rundomain_ext(2)
        N_rstrct_BC = N_rstrct_BC + 1
        lon_rstrct(N_rstrct_BC)=lon_ext(i,j)
        lat_rstrct(N_rstrct_BC)=lat_ext(i,j)
     enddo
     i=rundomain_ext(1)
     do j=rundomain_ext(3)+1,rundomain_ext(4)-1
        N_rstrct_BC = N_rstrct_BC + 1
        lon_rstrct(N_rstrct_BC)=lon_ext(i,j)
        lat_rstrct(N_rstrct_BC)=lat_ext(i,j)
     enddo
     i=rundomain_ext(2)
     do j=rundomain_ext(3)+1,rundomain_ext(4)-1
        N_rstrct_BC = N_rstrct_BC + 1
        lon_rstrct(N_rstrct_BC)=lon_ext(i,j)
        lat_rstrct(N_rstrct_BC)=lat_ext(i,j)
     enddo
     if(N_rstrct_BC/=2*(rundomain_ext(2)-rundomain_ext(1)+1)+2*(rundomain_ext(4)-rundomain_ext(3)-1))then
        write(*,*)'accounting error'
        stop
     endif
     deallocate(lon_ext,lat_ext)
     CALL MPI_BCAST(N_rstrct_BC,1,MPI_INTEGER,0,MPI_COMM_CALC,IERROR)
  else
     CALL MPI_BCAST(N_rstrct_BC,1,MPI_INTEGER,0,MPI_COMM_CALC,IERROR)
     allocate(lon_rstrct(N_rstrct_BC))
     allocate(lat_rstrct(N_rstrct_BC))
  endif

  CALL MPI_BCAST(lon_rstrct,N_rstrct_BC*8,MPI_BYTE,0,MPI_COMM_CALC,IERROR)
  CALL MPI_BCAST(lat_rstrct,N_rstrct_BC*8,MPI_BYTE,0,MPI_COMM_CALC,IERROR)

  allocate(IIij_rstrct(4,N_rstrct_BC))
  allocate(JJij_rstrct(4,N_rstrct_BC))
  allocate(Weight_rstrct(4,N_rstrct_BC))

  !find nearest neighbors of model grid for each lon_rstrct_BC lat_rstrct_BC
  allocate(glon_rundom(GIMAX,GJMAX))
  allocate(glat_rundom(GIMAX,GJMAX))
  glon_rundom=0.0
  glat_rundom=0.0
  do j=1,ljmax
     do i=1,limax
        glon_rundom(gi0+i-1,gj0+j-1)=glon(i,j)
        glat_rundom(gi0+i-1,gj0+j-1)=glat(i,j)
     enddo
  enddo
  CALL MPI_ALLREDUCE(MPI_IN_PLACE, glon_rundom, GIMAX*GJMAX, &
       MPI_DOUBLE_PRECISION, MPI_SUM, MPI_COMM_CALC, IERROR)
  CALL MPI_ALLREDUCE(MPI_IN_PLACE, glat_rundom, GIMAX*GJMAX, &
       MPI_DOUBLE_PRECISION, MPI_SUM, MPI_COMM_CALC, IERROR)

  !divide the work among processors
  N_rstrct_BC_per_proc=(N_rstrct_BC+NPROC-1)/NPROC

  ! find the four closest points
!  call grid2grid_coeff( &
!       lon_rstrct,lat_rstrct,         &
!       IIij_rstrct,JJij_rstrct,Weight_rstrct,   & ! Returns coordinates of 4 nearest pts and weights
!       glon_rundom,glat_rundom,GIMAX,GJMAX,N_rstrct_BC,1,N_rstrct_BC,1,&
!       .false., 1, 1) !1,1 is just a crude coord, while checking
  IIij_rstrct=0
  JJij_rstrct=0
  Weight_rstrct=0.0
  do n=me*N_rstrct_BC_per_proc+1,min((me+1)*N_rstrct_BC_per_proc,N_rstrct_BC)
     call point2grid_coeff(lon_rstrct(n),lat_rstrct(n),&
          IIij_rstrct(1,n),JJij_rstrct(1,n),Weight_rstrct(1,n),&
          glon_rundom,glat_rundom,GIMAX,GJMAX,.false.)
  enddo
  deallocate(glon_rundom,glat_rundom,lon_rstrct,lat_rstrct)
  CALL MPI_ALLREDUCE(MPI_IN_PLACE, IIij_rstrct, 4*N_rstrct_BC, &
       MPI_INTEGER, MPI_SUM, MPI_COMM_CALC, IERROR)
  CALL MPI_ALLREDUCE(MPI_IN_PLACE, JJij_rstrct, 4*N_rstrct_BC, &
       MPI_INTEGER, MPI_SUM, MPI_COMM_CALC, IERROR)
  CALL MPI_ALLREDUCE(MPI_IN_PLACE, Weight_rstrct, 4*N_rstrct_BC, &
       MPI_DOUBLE_PRECISION, MPI_SUM, MPI_COMM_CALC, IERROR)

  mask_restrict = .false. !default: do not include
  do n=1, N_rstrct_BC
     do n4=1, 4
        i=IIij_rstrct(n4,n)
        j=JJij_rstrct(n4,n)
        if(i>=gi0 .and. i<=gi1 .and. j>=gj0 .and. j<=gj1)then
           if(abs(Weight_rstrct(n4,n))> 1.0E-6)then !contribute little, probably noise
              mask_restrict(i-gi0+1,j-gj0+1)= .true.
           endif
        endif
     enddo
  enddo
  deallocate(IIij_rstrct,JJij_rstrct,Weight_rstrct)

  if(mydebug) &
       write(*,*)'Nest: finished determination of interpolation parameters'
contains
  function get_dimLen(dimName,id,name) result(len)
    character(len=*), dimension(:), intent(in) :: dimName
    integer,          optional,     intent(out):: id
    character(len=*), optional,     intent(out):: name
    integer :: d, dID, len

    do d=1,size(dimName)
       status = nf90_inq_dimid(ncFileID,dimName(d),dID)
       if(status==nf90_noerr)then
          if(present(id))  id=dID
          if(present(name))name=trim(dimName(d))
          call check(nf90_inquire_dimension(ncFileID,dID,len=len),&
               "get_dimLen: "//trim(dimName(d)))
          exit
       end if
    end do
    call CheckStop(status,nf90_noerr,'Nest: '//&
         trim(dimName(1))//'-dimension not found: '//&
         trim(filename_read)//'. Include new name in init_nest_restrict')
  end function get_dimLen
end subroutine init_mask_restrict

!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
JohnJohanssonChalmers commented 6 years ago

Ok, I will try this when I have some time. Is there any reason for the strange formating of the code in your last reply? Some parts of the code are formated as code, while some are formated as normal text.

gitpeterwind commented 6 years ago

The formatting comes because I just cut and paste here. But github interpret this as restructured text. If you wish the file directly I can send it to you by e-mail (send me your e-mail address then, or I can give it to Dave).

avaldebe commented 6 years ago

@gitpeterwind you can specify the language of your code snippets. I edited your previous answer so it displays correctly. Have a look at what did.

gitpeterwind commented 6 years ago

Thanks Álvaro, this looks better!

gitpeterwind commented 6 years ago

I have now updated the routine above so that it is more robust. Compared to previous versions:

  1. Wrf metdata accepted
  2. RUNDOMAIN does not need to start at 1
  3. If RUNDOMAIN_inner is not specified, it assumes entire inner domain (i.e as specified in MET_inner) is required
avaldebe commented 6 years ago

@gitpeterwind Is this patch on the open source repository (emep-ctm) or on the research repository (emep-mscw)?

avaldebe commented 6 years ago

I compiled and uploaded the user guide, which now contains RUNDOMAIN_inner/MET_inner example usage. Please let me know if this issue is resolved, so we can close it.

gitpeterwind commented 6 years ago

I just pushed it to the dev branch

avaldebe commented 6 years ago

Great. I'll keep this issue open until the next open source release.

JohnJohanssonChalmers commented 6 years ago

I have now tested the updated code and it seems to work as expected. Thank you for solving this so quickly!

avaldebe commented 6 years ago

As far as I can tell the documentation was updated and the bug was addressed on the latest model release (rv4_17), so I'm closing this issue...If I'm wrong, please re-open it.