metno / emep-ctm

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

High initial memory usage during read in of Land Use maps #122

Closed rubenww closed 1 month ago

rubenww commented 2 months ago

Dear EMEP modellers,

We've noticed that the initial memory usage during the reading in of the land use maps is very high in EMEP and that it scales with the number of cpu cores that is used. I'm using v4.45 currently.

In our configuration, it turned out that we needed approximately 1.5GB / cpu core in memory, or EMEP would crash during the reading in of the land use map, after the following steps:

RdLndCDF: Starting           2           1
 MapFile /EMEP/EMEP/rv5.00/input/base/Landuse_PS_1km_LC.nc
 MapFile /EMEP/EMEP/rv5.00/input/base/glc2000xCLMf18.nc
RdLndCDF:LANDUSE: found  1 .../Landuse_PS_1km_LC.nc

As you can see, we're using the 1x1km landuse file. During the rest of the run, only approximately 250 MB / cpu core in memory is needed for the calculation. This is more in line with the requirements stated in the EMEP user guide. The domain size is 153x135 cells in this case (approx. 3x6 km resolution, lon-lat).

I briefly looked in the code in ReadLanduse_CDF from Landuse_mod.f90 (in EMEP v4.45) and noticed the following comment:

!1)check that file exists
!  (note that every processor opens/reads the same file)

If indeed the landuse is read in for each processor, this would explain the high initial memory usage. Is that indeed the case and if so, are there any fundamental reasons why this is necessary?

Or could the code perhaps be adjusted in such a way that the same domain decomposition is applied to the land use maps, so that the memory requirements for running EMEP on multiple cores can be lower?

To illustrate, we're typically using 24 cores and this requires approximately 34GB in memory due to the above "problem", while after the land use has been read in, only around 6 GB of memory is in use.

Thank you for your help.

Best, Ruben Verweij

gitpeterwind commented 2 months ago

Hi Ruben, This may well be the case. The reason is (probably) that it is not that simple to know in advance which portion of the map is needed on each MPI domain (the 1km map is in polar stereographic projection). Since we do not need the 1km map in most of our runs, we have not prioritized to improve this. Maybe if you only use a small section of this map, you could try to make your own smaller map that cover only your region?

Best wishes, Peter

rubenww commented 2 months ago

Hi Peter,

Thank you for your explanation. I understand, in that case we'll have a look if we can make a smaller map based on the full file.

Best, Ruben

rubenww commented 2 months ago

Dear Peter @gitpeterwind ,

One additional question: I've tried to crop the landuse file using the cdo command:

cdo -selindexbox,2299,3478,1662,2889 Landuse_PS_1km_LC.nc Landuse_PS_1km_LC_level02_RIVM.nc

This gives the following results for LC:U:EMEP as an example: image

This seems to be as expected. However, it is not correctly loaded in EMEP. I don't see any error messages, but the resulting field shows only the global landuse input from the glc2000xCLMf18.nc file: image

I do see that both files are loaded in the EMEP log:

RdLndCDF: Starting           2           1
 MapFile /EMEP/EMEP/rv5.00/input/base/Landuse_PS_1km_LC_level02_RIVM.nc
 MapFile /EMEP/EMEP/rv5.00/input/base/glc2000xCLMf18.nc
RdLndCDF:LANDUSE: found  1 .../Landuse_PS_1km_LC_level02_RIVM.nc
RdLndCDF:LANDUSE: found  2 .../glc2000xCLMf18.nc
LandDefs DONE maxmin   1.0000E+00  0.0000E+00
 CDFLAND_CODES:           32  :
CF                  DF                  NF                  BF                  TC                  
MC                  RC                  SNL                 GR                  MS                  
WE                  TU                  DE                  W                   ICE                 
U                   BARE                NDLF_EVGN_TMPT_TREE NDLF_EVGN_BORL_TREE NDLF_DECD_BORL_TREE 
BDLF_EVGN_TROP_TREE BDLF_EVGN_TMPT_TREE BDLF_DECD_TROP_TREE BDLF_DECD_TMPT_TREE BDLF_DECD_BORL_TREE 
BDLF_EVGN_SHRB      BDLF_DECD_TMPT_SHRB BDLF_DECD_BORL_SHRB C3_ARCT_GRSS        C3_NARC_GRSS        
C4_GRSS             CROP                
 InitLanduse: IAM GlobRun?  F
 InitLanduse: NLand_codes           32
 InitLanduse: Codes: CF                          DF                          
 NF                          BF                          
 TC                          MC                          
 RC                          SNL                         
 GR                          MS                          
 WE                          TU                          
 DE                          W                           
 ICE                         U                           
 BARE                        NDLF_EVGN_TMPT_TREE         
 NDLF_EVGN_BORL_TREE         NDLF_DECD_BORL_TREE         
 BDLF_EVGN_TROP_TREE         BDLF_EVGN_TMPT_TREE         
 BDLF_DECD_TROP_TREE         BDLF_DECD_TMPT_TREE         
 BDLF_DECD_BORL_TREE         BDLF_EVGN_SHRB              
 BDLF_DECD_TMPT_SHRB         BDLF_DECD_BORL_SHRB         
 C3_ARCT_GRSS                C3_NARC_GRSS                
 C4_GRSS                     CROP                        

 InitLanduse: LandCoverInputs: 
 /EMEP/EMEP/rv5.00/input/base/Landuse_PS_1km_LC_level02_RIVM.nc
 /EMEP/EMEP/rv5.00/input/base/glc2000xCLMf18.nc
 /EMEP/EMEP/rv5.00/input/base/Inputs_LandDefs.csv
 /EMEP/EMEP/rv5.00/input/base/Inputs_DO3SE.csv
 /EMEP/EMEP/rv5.00/input/base/medMap_0.5deg.nc
 Ini-LandDefs: for Ncodes=           32
 Ini-LandDefs:LC  wants            1 CF
 Ini-LandDefs:LC  wants            2 DF
 Ini-LandDefs:LC  wants            3 NF
 Ini-LandDefs:LC  wants            4 BF
 Ini-LandDefs:LC  wants            5 TC
 Ini-LandDefs:LC  wants            6 MC
 Ini-LandDefs:LC  wants            7 RC
 Ini-LandDefs:LC  wants            8 SNL
 Ini-LandDefs:LC  wants            9 GR
 Ini-LandDefs:LC  wants           10 MS
 Ini-LandDefs:LC  wants           11 WE
 Ini-LandDefs:LC  wants           12 TU
 Ini-LandDefs:LC  wants           13 DE
 Ini-LandDefs:LC  wants           14 W
 Ini-LandDefs:LC  wants           15 ICE
 Ini-LandDefs:LC  wants           16 U
 Ini-LandDefs:LC  wants           17 BARE
 Ini-LandDefs:LC  wants           18 NDLF_EVGN_TMPT_TREE
 Ini-LandDefs:LC  wants           19 NDLF_EVGN_BORL_TREE
 Ini-LandDefs:LC  wants           20 NDLF_DECD_BORL_TREE
 Ini-LandDefs:LC  wants           21 BDLF_EVGN_TROP_TREE
 Ini-LandDefs:LC  wants           22 BDLF_EVGN_TMPT_TREE
 Ini-LandDefs:LC  wants           23 BDLF_DECD_TROP_TREE
 Ini-LandDefs:LC  wants           24 BDLF_DECD_TMPT_TREE
 Ini-LandDefs:LC  wants           25 BDLF_DECD_BORL_TREE
 Ini-LandDefs:LC  wants           26 BDLF_EVGN_SHRB
 Ini-LandDefs:LC  wants           27 BDLF_DECD_TMPT_SHRB
 Ini-LandDefs:LC  wants           28 BDLF_DECD_BORL_SHRB
 Ini-LandDefs:LC  wants           29 C3_ARCT_GRSS
 Ini-LandDefs:LC  wants           30 C3_NARC_GRSS
 Ini-LandDefs:LC  wants           31 C4_GRSS
 Ini-LandDefs:LC  wants           32 CROP
 Ini-LandDefs:opened /EMEP/EMEP/rv5.00/input/base/Inputs_LandDefs.csv
RdLndCDF:F3  START 32      0.0000    16    27   108    10    45
Ini-LandDefs:MATCH  0  1CF                  CF                  
Ini-LandDefs:MATCH  1  2DF                  DF                  
Ini-LandDefs:MATCH  2  3NF                  NF                  
Ini-LandDefs:MATCH  3  4BF                  BF                  
Ini-LandDefs:MATCH  4  5TC                  TC                  
Ini-LandDefs:MATCH  5  6MC                  MC                  
Ini-LandDefs:MATCH  6  7RC                  RC                  
Ini-LandDefs:MATCH  7  8SNL                 SNL                 
Ini-LandDefs:MATCH  8  9GR                  GR                  
Ini-LandDefs:MATCH  9 10MS                  MS                  
Ini-LandDefs:MATCH 10 11WE                  WE                  
Ini-LandDefs:MATCH 11 12TU                  TU                  
Ini-LandDefs:MATCH 12 13DE                  DE                  
Ini-LandDefs:MATCH 13 14W                   W                   
Ini-LandDefs:MATCH 14 15ICE                 ICE                 
Ini-LandDefs:MATCH 15 16U                   U                   
 Ini-LandDefs: skipping nn,n           16        -999 IAM_WH
 Ini-LandDefs: skipping nn,n           16        -999 IAM_WH_MED
 Ini-LandDefs: skipping nn,n           16        -999 IAM_WH_Irrig
 Ini-LandDefs: skipping nn,n           16        -999 IAM_WH_MED_Irrig
 Ini-LandDefs: skipping nn,n           16        -999 IAM_DF
 Ini-LandDefs: skipping nn,n           16        -999 IAM_DF_MED
 Ini-LandDefs: skipping nn,n           16        -999 IAM_SNL
 Ini-LandDefs: skipping nn,n           16        -999 IAM_SNL_MED
Ini-LandDefs:MATCH 16 18NDLF_EVGN_TMPT_TREE NDLF_EVGN_TMPT_TREE 
Ini-LandDefs:MATCH 17 19NDLF_EVGN_BORL_TREE NDLF_EVGN_BORL_TREE 
Ini-LandDefs:MATCH 18 20NDLF_DECD_BORL_TREE NDLF_DECD_BORL_TREE 
Ini-LandDefs:MATCH 19 21BDLF_EVGN_TROP_TREE BDLF_EVGN_TROP_TREE 
Ini-LandDefs:MATCH 20 22BDLF_EVGN_TMPT_TREE BDLF_EVGN_TMPT_TREE 
Ini-LandDefs:MATCH 21 23BDLF_DECD_TROP_TREE BDLF_DECD_TROP_TREE 
Ini-LandDefs:MATCH 22 24BDLF_DECD_TMPT_TREE BDLF_DECD_TMPT_TREE 
Ini-LandDefs:MATCH 23 25BDLF_DECD_BORL_TREE BDLF_DECD_BORL_TREE 
Ini-LandDefs:MATCH 24 26BDLF_EVGN_SHRB      BDLF_EVGN_SHRB      
Ini-LandDefs:MATCH 25 27BDLF_DECD_TMPT_SHRB BDLF_DECD_TMPT_SHRB 
Ini-LandDefs:MATCH 26 28BDLF_DECD_BORL_SHRB BDLF_DECD_BORL_SHRB 
Ini-LandDefs:MATCH 27 29C3_ARCT_GRSS        C3_ARCT_GRSS        
Ini-LandDefs:MATCH 28 30C3_NARC_GRSS        C3_NARC_GRSS        
Ini-LandDefs:MATCH 29 31C4_GRSS             C4_GRSS             
Ini-LandDefs:MATCH 30 32CROP                CROP                
Ini-LandDefs:MATCH 31 17BARE                BARE                
 Ini-LandDefs:DONE NN,NCODES =           32          32
 InitLanduse: n2dGS:            0
InitLanduse: LU_SETGS  1 14water                  0  -1 366 F F
InitLanduse:SEACOAST  145 153  1.000 T F
InitLanduse:ALTendInitW   1   1   0   0

So it seems that the grid information is not correctly loaded from the cropped 1 x 1 km landuse file. Do you have any tips on how to modify the file so that EMEP can read it correctly?

If helpful, the cropped landuse file can be downloaded via https://filesender.rivm.nl/?s=download&token=c003ed05-deeb-4857-8a0a-bfb644fbabb3

Thanks and best, Ruben

gitpeterwind commented 2 months ago

Hi Ruben, I won't be able to look into this this week, but will try next week.

Best wishes, Peter

mifads commented 2 months ago

Hi Ruben, I also have trouble digging into this just now, but did you try setting DEBUG%LANDUSE = 1, together with some DEBUG%IJ values from within your inner grid. Then you should see which landcovers are read in and used for that cell. (Look for "InitLanduse:" lines in the output log.)

This is puzzling since I have worked with the LC many many times, and the inner domain has always seemed to work. Also, some outputs (e.g. POD1_CF) are only produced over the European area, since CF isn't part of the global LC. Best wishes Dave

rubenww commented 1 month ago

Hi Dave, Thank you for your suggestion. I've started two test runs, one with the original 1x1km land use file and one with the cropped version.

For the original one, I get for land use 'U':

RdLndCDF:IFILE  1    52.36    4.83 LC:U:EMEP
RdLndCDF:F1    1  16  16   7.604E-01   1.000E+00   9.208E-01   0.000E+00 U

For the cropped version:

RdLndCDF:IFILE  1    52.36    4.83 LC:U:EMEP
RdLndCDF:F1    1  16  16  -9.900E+19   0.000E+00  -9.900E+19   0.000E+00 U

All the other classes also give -9.900E+19 which is equivalent to a missing value. So I guess due to the cropping, the coordinates are not read in correctly anymore.

I have attached the log files with all the land use debug output if that is helpful.

landuse_debug_cropped_1km_LU_file.txt landuse_debug_original_1km_LU_file.txt

Please let me know if you have any thoughts on how to crop the file in such a way that EMEP can still process the coordinate system correctly.

Thanks and best, Ruben

gitpeterwind commented 1 month ago

ncdump -h on the cropped and uncropped files are identical, except for the dimension sizes?

rubenww commented 1 month ago

This is the output of ncdump -h for the original:

netcdf Landuse_PS_1km_LC {
dimensions:
    i = 6250 ;
    j = 6610 ;
variables:
    double i(i) ;
        i:coord_axis = "x" ;
        i:long_name = "EMEP grid x coordinate" ;
        i:units = "km" ;
    double j(j) ;
        j:coord_axis = "y" ;
        j:long_name = "EMEP grid y coordinate" ;
        j:units = "km" ;
    double map_factor(j, i) ;
        map_factor:long_name = "mapping factor" ;
        map_factor:units = "" ;
    double lat(j, i) ;
        lat:long_name = "latitude coordinate" ;
        lat:standard_name = "latitude" ;
        lat:units = "degrees_north" ;
    double lon(j, i) ;
        lon:long_name = "longitude coordinate" ;
        lon:standard_name = "longitude" ;
        lon:units = "degrees_east" ;
    float Total(j, i) ;
        Total:long_name = "Total" ;
        Total:_FillValue = -9.9e+09f ;
    float LC\:CF\:EMEP(j, i) ;
        LC\:CF\:EMEP:long_name = "CF" ;
        LC\:CF\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:DF\:EMEP(j, i) ;
        LC\:DF\:EMEP:long_name = "DF" ;
        LC\:DF\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:NF\:EMEP(j, i) ;
        LC\:NF\:EMEP:long_name = "NF" ;
        LC\:NF\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:BF\:EMEP(j, i) ;
        LC\:BF\:EMEP:long_name = "BF" ;
        LC\:BF\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:TC\:EMEP(j, i) ;
        LC\:TC\:EMEP:long_name = "TC" ;
        LC\:TC\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:MC\:EMEP(j, i) ;
        LC\:MC\:EMEP:long_name = "MC" ;
        LC\:MC\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:RC\:EMEP(j, i) ;
        LC\:RC\:EMEP:long_name = "RC" ;
        LC\:RC\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:SNL\:EMEP(j, i) ;
        LC\:SNL\:EMEP:long_name = "SNL" ;
        LC\:SNL\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:GR\:EMEP(j, i) ;
        LC\:GR\:EMEP:long_name = "GR" ;
        LC\:GR\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:MS\:EMEP(j, i) ;
        LC\:MS\:EMEP:long_name = "MS" ;
        LC\:MS\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:WE\:EMEP(j, i) ;
        LC\:WE\:EMEP:long_name = "WE" ;
        LC\:WE\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:TU\:EMEP(j, i) ;
        LC\:TU\:EMEP:long_name = "TU" ;
        LC\:TU\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:DE\:EMEP(j, i) ;
        LC\:DE\:EMEP:long_name = "DE" ;
        LC\:DE\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:W\:EMEP(j, i) ;
        LC\:W\:EMEP:long_name = "W" ;
        LC\:W\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:ICE\:EMEP(j, i) ;
        LC\:ICE\:EMEP:long_name = "ICE" ;
        LC\:ICE\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:U\:EMEP(j, i) ;
        LC\:U\:EMEP:long_name = "U" ;
        LC\:U\:EMEP:_FillValue = -9.9e+09f ;
    float LC\:IAM_VEG\:EMEP(j, i) ;
        LC\:IAM_VEG\:EMEP:long_name = "IAM_CR" ;
        LC\:IAM_VEG\:EMEP:_FillValue = -9.9e+09f ;
    float OLD\:IAM_DF\:EMEP(j, i) ;
        OLD\:IAM_DF\:EMEP:long_name = "IAM_DF" ;
        OLD\:IAM_DF\:EMEP:_FillValue = -9.9e+09f ;
    float OLD\:IAM_MF\:EMEP(j, i) ;
        OLD\:IAM_MF\:EMEP:long_name = "IAM_MF" ;
        OLD\:IAM_MF\:EMEP:_FillValue = -9.9e+09f ;

// global attributes:
        :Conventions = "CF-1.0" ;
        :projection = "Stereographic" ;
        :projection_params = "90.0 -32.0 0.933013" ;
        :Grid_resolution = 1000. ;
        :xcoordinate_NorthPole = 375.5 ;
        :ycoordinate_NorthPole = 5475.5 ;
        :fi = -32. ;
        :ref_latitude = 60. ;
        :created_date = "20131112" ;
        :created_hour = "095501.147" ;
        :lastmodified_date = "" ;
        :lastmodified_hour = "" ;
        :history = "Tue Nov 12 11:56:24 2013: ncrename -v LC:IAM_MF:EMEP,OLD:IAM_MF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v LC:IAM_DF:EMEP,OLD:IAM_DF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v LC:IAM_CR:EMEP,LC:IAM_VEG:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v IAM_MF,LC:IAM_MF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v IAM_DF,LC:IAM_DF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v IAM_CR,LC:IAM_CR:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v U,LC:U:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v ICE,LC:ICE:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v W,LC:W:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v DE,LC:DE:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v TU,LC:TU:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v WE,LC:WE:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v MS,LC:MS:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v GR,LC:GR:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v SNL,LC:SNL:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v RC,LC:RC:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v MC,LC:MC:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v TC,LC:TC:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v BF,LC:BF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v NF,LC:NF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v DF,LC:DF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v CF,LC:CF:EMEP Landuse_PS_1km_LC.nc" ;
}

And the cropped version:

netcdf Landuse_PS_1km_LC_level02_RIVM {
dimensions:
    i = 1180 ;
    j = 1228 ;
variables:
    double i(i) ;
        i:long_name = "EMEP grid x coordinate" ;
        i:units = "km" ;
        i:axis = "X" ;
    double j(j) ;
        j:long_name = "EMEP grid y coordinate" ;
        j:units = "km" ;
        j:axis = "Y" ;
    double map_factor(j, i) ;
        map_factor:long_name = "mapping factor" ;
    double lat(j, i) ;
        lat:standard_name = "latitude" ;
        lat:long_name = "latitude coordinate" ;
        lat:units = "degrees_north" ;
    double lon(j, i) ;
        lon:standard_name = "longitude" ;
        lon:long_name = "longitude coordinate" ;
        lon:units = "degrees_east" ;
    float Total(j, i) ;
        Total:long_name = "Total" ;
        Total:_FillValue = -9.9e+09f ;
        Total:missing_value = -9.9e+09f ;
    float LC\:CF\:EMEP(j, i) ;
        LC\:CF\:EMEP:long_name = "CF" ;
        LC\:CF\:EMEP:_FillValue = -9.9e+09f ;
        LC\:CF\:EMEP:missing_value = -9.9e+09f ;
    float LC\:DF\:EMEP(j, i) ;
        LC\:DF\:EMEP:long_name = "DF" ;
        LC\:DF\:EMEP:_FillValue = -9.9e+09f ;
        LC\:DF\:EMEP:missing_value = -9.9e+09f ;
    float LC\:NF\:EMEP(j, i) ;
        LC\:NF\:EMEP:long_name = "NF" ;
        LC\:NF\:EMEP:_FillValue = -9.9e+09f ;
        LC\:NF\:EMEP:missing_value = -9.9e+09f ;
    float LC\:BF\:EMEP(j, i) ;
        LC\:BF\:EMEP:long_name = "BF" ;
        LC\:BF\:EMEP:_FillValue = -9.9e+09f ;
        LC\:BF\:EMEP:missing_value = -9.9e+09f ;
    float LC\:TC\:EMEP(j, i) ;
        LC\:TC\:EMEP:long_name = "TC" ;
        LC\:TC\:EMEP:_FillValue = -9.9e+09f ;
        LC\:TC\:EMEP:missing_value = -9.9e+09f ;
    float LC\:MC\:EMEP(j, i) ;
        LC\:MC\:EMEP:long_name = "MC" ;
        LC\:MC\:EMEP:_FillValue = -9.9e+09f ;
        LC\:MC\:EMEP:missing_value = -9.9e+09f ;
    float LC\:RC\:EMEP(j, i) ;
        LC\:RC\:EMEP:long_name = "RC" ;
        LC\:RC\:EMEP:_FillValue = -9.9e+09f ;
        LC\:RC\:EMEP:missing_value = -9.9e+09f ;
    float LC\:SNL\:EMEP(j, i) ;
        LC\:SNL\:EMEP:long_name = "SNL" ;
        LC\:SNL\:EMEP:_FillValue = -9.9e+09f ;
        LC\:SNL\:EMEP:missing_value = -9.9e+09f ;
    float LC\:GR\:EMEP(j, i) ;
        LC\:GR\:EMEP:long_name = "GR" ;
        LC\:GR\:EMEP:_FillValue = -9.9e+09f ;
        LC\:GR\:EMEP:missing_value = -9.9e+09f ;
    float LC\:MS\:EMEP(j, i) ;
        LC\:MS\:EMEP:long_name = "MS" ;
        LC\:MS\:EMEP:_FillValue = -9.9e+09f ;
        LC\:MS\:EMEP:missing_value = -9.9e+09f ;
    float LC\:WE\:EMEP(j, i) ;
        LC\:WE\:EMEP:long_name = "WE" ;
        LC\:WE\:EMEP:_FillValue = -9.9e+09f ;
        LC\:WE\:EMEP:missing_value = -9.9e+09f ;
    float LC\:TU\:EMEP(j, i) ;
        LC\:TU\:EMEP:long_name = "TU" ;
        LC\:TU\:EMEP:_FillValue = -9.9e+09f ;
        LC\:TU\:EMEP:missing_value = -9.9e+09f ;
    float LC\:DE\:EMEP(j, i) ;
        LC\:DE\:EMEP:long_name = "DE" ;
        LC\:DE\:EMEP:_FillValue = -9.9e+09f ;
        LC\:DE\:EMEP:missing_value = -9.9e+09f ;
    float LC\:W\:EMEP(j, i) ;
        LC\:W\:EMEP:long_name = "W" ;
        LC\:W\:EMEP:_FillValue = -9.9e+09f ;
        LC\:W\:EMEP:missing_value = -9.9e+09f ;
    float LC\:ICE\:EMEP(j, i) ;
        LC\:ICE\:EMEP:long_name = "ICE" ;
        LC\:ICE\:EMEP:_FillValue = -9.9e+09f ;
        LC\:ICE\:EMEP:missing_value = -9.9e+09f ;
    float LC\:U\:EMEP(j, i) ;
        LC\:U\:EMEP:long_name = "U" ;
        LC\:U\:EMEP:_FillValue = -9.9e+09f ;
        LC\:U\:EMEP:missing_value = -9.9e+09f ;
    float LC\:IAM_VEG\:EMEP(j, i) ;
        LC\:IAM_VEG\:EMEP:long_name = "IAM_CR" ;
        LC\:IAM_VEG\:EMEP:_FillValue = -9.9e+09f ;
        LC\:IAM_VEG\:EMEP:missing_value = -9.9e+09f ;
    float OLD\:IAM_DF\:EMEP(j, i) ;
        OLD\:IAM_DF\:EMEP:long_name = "IAM_DF" ;
        OLD\:IAM_DF\:EMEP:_FillValue = -9.9e+09f ;
        OLD\:IAM_DF\:EMEP:missing_value = -9.9e+09f ;
    float OLD\:IAM_MF\:EMEP(j, i) ;
        OLD\:IAM_MF\:EMEP:long_name = "IAM_MF" ;
        OLD\:IAM_MF\:EMEP:_FillValue = -9.9e+09f ;
        OLD\:IAM_MF\:EMEP:missing_value = -9.9e+09f ;

// global attributes:
        :CDI = "Climate Data Interface version 1.9.1 (http://mpimet.mpg.de/cdi)" ;
        :history = "Mon Apr 22 16:48:11 2024: cdo -selindexbox,2299,3478,1662,2889 Landuse_PS_1km_LC.nc Landuse_PS_1km_LC_level02_RIVM.nc\nTue Nov 12 11:56:24 2013: ncrename -v LC:IAM_MF:EMEP,OLD:IAM_MF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v LC:IAM_DF:EMEP,OLD:IAM_DF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v LC:IAM_CR:EMEP,LC:IAM_VEG:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v IAM_MF,LC:IAM_MF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v IAM_DF,LC:IAM_DF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v IAM_CR,LC:IAM_CR:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v U,LC:U:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v ICE,LC:ICE:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v W,LC:W:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v DE,LC:DE:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v TU,LC:TU:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v WE,LC:WE:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v MS,LC:MS:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v GR,LC:GR:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v SNL,LC:SNL:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v RC,LC:RC:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v MC,LC:MC:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v TC,LC:TC:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v BF,LC:BF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v NF,LC:NF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v DF,LC:DF:EMEP Landuse_PS_1km_LC.nc\nTue Nov 12 11:56:24 2013: ncrename -v CF,LC:CF:EMEP Landuse_PS_1km_LC.nc" ;
        :Conventions = "CF-1.0" ;
        :projection = "Stereographic" ;
        :projection_params = "90.0 -32.0 0.933013" ;
        :Grid_resolution = 1000. ;
        :xcoordinate_NorthPole = 375.5 ;
        :ycoordinate_NorthPole = 5475.5 ;
        :fi = -32. ;
        :ref_latitude = 60. ;
        :created_date = "20131112" ;
        :created_hour = "095501.147" ;
        :CDO = "Climate Data Operators version 1.9.1 (http://mpimet.mpg.de/cdo)" ;
}

The only notable difference, apart from dimension size, is that CDO added the missing_value attribute: LC\:ICE\:EMEP:missing_value = -9.9e+09f ; Is that somehow affecting the EMEP NetCDF routines?

gitpeterwind commented 1 month ago

It is possible that the xcoordinate_NorthPole and ycoordinate_NorthPole are not the correct one on the new map. They are used to define the origin. The new values depend on which portion of the map you have cut out: if you have removed nx gridcells on the left of the map, you should subtract nx from 375.5 , and similar for ycoordinate_NorthPole (gridcells removed from bottom).

rubenww commented 1 month ago

Hi, I didn't realize but indeed this solves the problem. Thank you for your help!