Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ZNT to history in Registy or iofields #13

Open
jesusff opened this issue Dec 19, 2024 · 6 comments
Open

Add ZNT to history in Registy or iofields #13

jesusff opened this issue Dec 19, 2024 · 6 comments

Comments

@jesusff
Copy link
Member

jesusff commented Dec 19, 2024

Currently, there is no place in our protocol that enables this variable (the source of z0) in the WRF output.

@yoselita
Copy link
Contributor

yoselita commented Dec 19, 2024

The update has not be applied, as we were not sure which variable to use for roughness length. I added the varlist.txt that UCAN uses for their run, in which ZNT is added link.
There is a WRF branch with changed Registry (link) in which ZNT is added. This version removed many unnecessary variables and adds some that we need. We might check this and merge it to main?

@LluisFB
Copy link
Contributor

LluisFB commented Dec 19, 2024

In my simulations I did not have ZNT as output, therefore I provided it as static variable reading its values from crossing 'LU_INDEX' and the correspondent 'VEGPARM.TBL'

@LluisFB
Copy link
Contributor

LluisFB commented Dec 19, 2024

Also, you might be able to directly avoid all wrfout, if you want to use the CORDEX-WRF module
https://wiki.cima.fcen.uba.ar/mediawiki/index.php/CDXWRF

@yoselita
Copy link
Contributor

Thank you @LluisFB for the details. In the variable list z0 should be fixed field. Which values from VEGPARM.TBL are you using to get the output, Z0MIN or Z0MAX? I checked the output for ZNT, and the values are mostly constant, only in the Alps the value is changing due to snow melt.

@LluisFB
Copy link
Contributor

LluisFB commented Dec 20, 2024

Hi Josipa,

Here the python code I am using, already implemented in my CMORization python tool that I am trying to fix

def var_WRFz0lu(vegtype, vegtbl, dataset):
    """ Function to compute z0 from WRF input using dominant landuse type 
        (LU_INDEX)
      vegtype: 2D matrix with dominant vegetation types
      vegtbl: full path to 'VEGPARM.TBL' file to read the actual values
      dataset: which set of values
    """
    fname = 'WRFz0lu'
    
    # Dictionary with the urban types for each dataset
    print (infmsg)

    vegparm = gen.read_VEGPARM(vegtbl, dataset)
    
    z0 = vegtype*0. + gen.fillValueR

    if dataset == 'USGS-RUC' or dataset == 'MODI-RUC':  
        # Column to get
        colname = 'Z0'
        icolname = gen.index_vec(vegparm['labels'], colname)
        if icolname == -1:
            print (errormsg)
            print ('   ' + fname + ": column named '" + colname + "' not found in "+ \
              "VEGPARM.TBL file '" + vegtbl+ "' !!")
            colnames = vegparm['labels']
            colnames.sort()
            print ('    columns found:', colnames)
            quit(-1)
        
        # Setting up speed ! (addig 1 value, since landuse values start at 1)
        colval = [' ']*(vegparm['Ntypes']+1)
        for iveg in range(vegparm['Ntypes']):
            dicv = vegparm[iveg+1]
            colval[iveg+1] = dicv[icolname]
    else:
        # Column to get
        colname = 'Z0MIN'
        icolname = gen.index_vec(vegparm['labels'], colname)
        if icolname == -1:
            print (errormsg)
            print ('   ' + fname + ": column named '" + colname + "' not found in "+ \
              "VEGPARM.TBL file '" + vegtbl+ "' !!")
            colnames = vegparm['labels']
            colnames.sort()
            print ('    columns found:', colnames)
            quit(-1)
        
        # Setting up speed ! (addig 1 value, since landuse values start at 1)
        mincolval = np.full((vegparm['Ntypes']+1), 0.)
        for iveg in range(vegparm['Ntypes']):
            dicv = vegparm[iveg+1]
            mincolval[iveg+1] = dicv[icolname]

        colname = 'Z0MAX'
        icolname = gen.index_vec(vegparm['labels'], colname)
        if icolname == -1:
            print (errormsg)
            print ('   ' + fname + ": column named '" + colname + "' not found in "+ \
              "VEGPARM.TBL file '" + vegtbl+ "' !!")
            colnames = vegparm['labels']
            colnames.sort()
            print ('    columns found:', colnames)
            quit(-1)
        
        # Setting up speed ! (addig 1 value, since landuse values start at 1)
        maxcolval = np.full((vegparm['Ntypes']+1), 0.)
        for iveg in range(vegparm['Ntypes']):
            dicv = vegparm[iveg+1]
            maxcolval[iveg+1] = dicv[icolname]

        # Averaging, what else can be done?
        colval = 0.5*(mincolval + maxcolval)

    dx = z0.shape[1]
    dy = z0.shape[0]
    
    # Looping along 2D
    for j in range(dy):
        for i in range(dx):
            # LCZ values (from URBPARM_LCZ.TBL, Z0G and Z0R)
            if int(vegtype[j,i]) >= 51:
                z0[j,i] = 0.01            
            else:
                z0[j,i] = colval[int(vegtype[j,i])]
    
    return z0

@ritamcardoso
Copy link

ritamcardoso commented Dec 28, 2024

We are using UST with wind speed at 10m (sqrt ( U10 **2 + V10 **2)) and assuming that the wind has a logarithmic profile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants